Robert Kosek
2008-Nov-24 16:22 UTC
Can''t seem to map a route as GET for controller/search/term
Hi all, I''m making a search features for a record with a keywords field (keywords is a string right now), and my routing is having consistency troubles. What I desire is:> localhost:3000/controller/search/:keywordI would like this form to be obeyed for both form-submitted searches and the HTML links I generate. However, :method => :get is not being obeyed, and my helper method returns "search?keyword=foo+bar". My routing is RESTful, and I have added the search action to the map.resources call. If I call "controller/search/keyword" directly I get this error:> undefined method `index_url'' for #<SermonsController:0x4a0e1c4>I find this curious. My routing is before the map.connect call for the standard format. Here''s my map call:> map.resources :sermons, :collection => { :search => :get }If I map the following line, I get a 500 error.> map.search_sermons ''sermons/search/:keyword'', > :controller => :sermons, :action => :searchAs you can guess this is confusing me. Have I done anything wrong? My links are forced into the "controller/search?keyword=foo+bar" format, and my forms remain POST methods no matter what I try to override them with. How should I go about routing this? Thanks, Robert P.S. I currently have the site working with what I have, but I''d really like to make it consistent with the rest of the site''s routing scheme. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---