Hello, I am trying to generate a URL in the following format using named routes: /band/index/?id=1 Despite what I try, I always get this: /band/index/1 Which is NOT what I want (the precise layout matters in this instance). Right now, I have the following route: map.band "band/?id=:id", :controller => "band", :action => "index" And the following link_to: <%= link_to @record.artist.display_name, band_url(:band_id => @record.artist.id) %> So, what I am doing wrong? How can I get Rails to do what I need? Thx. Hunter
Hunter Hillegas <lists-HAWAbpnI61OZ1JSuHaJ1sQC/G2K4zDHf@public.gmane.org> writes:> Right now, I have the following route: > > map.band "band/?id=:id", :controller => "band", :action => "index" > > And the following link_to: > > <%= link_to @record.artist.display_name, band_url(:band_id => > @record.artist.id) %>Put this after the default mapping for ":controller/:action/:id" in your routes.rb: map.band "band", :controller => "band", :action => "index" Then: <%= link_to "@record.artist.display_name", band_url(:id => @record.artist.id) %> Any name/value pairs passed into *_url show up as ?name=value unless the route specifies the name is part of the url. -- Doug Alcorn - http://lathi.net/RubyOnRailsDeveloper doug-jGAhs73c5XxeoWH0uzbU5w@public.gmane.org