I have the below routes defined:
What I'm trying to accomplish, is to be able to change where the platform part of the url is depending on how they navigate to a particular part of the site.Code:map.platform_first 'software/:platform/:software/:version/', :controller => 'user/version', :platform => /windows|macintosh|unix|linux/, :action => 'show' map.version_first 'software/:software/:version/:platform', :controller => 'user/version', :platform => /windows|macintosh|unix|linux/, :action => 'show'
If they navigate like so:
view_all_software->software_x->version_x_platform
I want the url to look like:
/software/thunderbird/1.1/windows
But if they navigate like this:
view_windows_software->software_x->version_x
I want the url to look like:
/software/windows/thunderbird/1.1
I thought named routes would be the solution. If I explicitly call:
The router ends up using platform_first instead. It looks like with routes, even if you use a named route, the first route to match, gets used? Is this how routes are supposed to work?Code:<%= version_first_url(:controller => 'version', :action => 'show', :software => url_case(@software.name), :version => url_case(v.name), :platform => url_case(v.platform.name)) %>
Thanks,
-Steven






Bookmarks