I don''t see a way to create a single URL in a collection and then have routing dispatch to the appropriate method based on the HTTP method. map.resources :packages, :collection=>{ :search=>:get } Gets me half way there, but I can see a way to say that I want the POST to go to the do_search method. Furthermore map.resources :packages, :collection=> { :search=>:get, :do_search=>:post } results in a ActionController::MethodNotAllowed for POSTs to /packages/ do_search. `rake routes` affirms that this should be accepted: do_search_packages POST /packages/do_search {:action=>"do_search", :controller=>"packages"} How can I solve either of these? Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi, I don''t have a solution for you but in general searches are GET and never POST. I don''t know where this nonsense comes from but it''s breaking the principles behind the HTTP. Did you try :any instead of :post ? ciao, tom On Jan 30, 7:46 pm, MaggotChild <hsomob1...-/E1597aS9LQAvxtiuMwx3w@public.gmane.org> wrote:> I don''t see a way to create a single URL in a collection and then have > routing dispatch to the appropriate method based on the HTTP method. > > map.resources :packages, :collection=>{ :search=>:get } > > Gets me half way there, but I can see a way to say that I want the > POST to go to the do_search method. > > Furthermore > > map.resources :packages, :collection=> > { :search=>:get, :do_search=>:post } > > results in a ActionController::MethodNotAllowed for POSTs to /packages/ > do_search. > > `rake routes` affirms that this should be accepted: > > do_search_packages POST /packages/do_search > {:action=>"do_search", :controller=>"packages"}--~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
> ..but in general searches are GET and > never POST. I don''t know where this nonsense comes from but > it''s breaking the principles behind the HTTP.Well I don''t disagree with this paradigm, but the point is Rails seems to not allow one to set up a route like the defaults provided by map.resourses. i.e one URL, dispatched to to 2 different actions based on HTTP method.> Did you try :any instead of :post ?Either one raises the nonsensical ActionController::MethodNotAllowed. I say nonsensical because rake routes tells me do_search accepts posts. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---