Hello there, My routes.rb has following map.resources "parties" , :controller=> "political_parties" , :collection => {:states => :get , :nationals => :get } In one of my views i was trying to do something like this <%= link_to_remote "State Parties" , :url=> states_parties_path ,:update => {:success => ''parties_list''} %> But I was getting following error on log ActionController::MethodNotAllowed (Only get, put, and delete requests are allowed.): Any idea whay this is? -- 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 -~----------~----~----~----~------~----~------~--~---
rubyguy-DaQTI0RpDDMAvxtiuMwx3w@public.gmane.org
2009-Mar-21 08:35 UTC
Re: routes path problem when using link_to_remote
On 21 Mar., 08:40, Shardul Mohite <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hello there, > > My routes.rb has following > > map.resources "parties" , :controller=> "political_parties" , > :collection => {:states => :get , :nationals => :get } > > In one of my views i was trying to do something like this > > <%= link_to_remote "State Parties" , :url=> states_parties_path ,:update > => {:success => ''parties_list''} %> > > But I was getting following error on log > > ActionController::MethodNotAllowed (Only get, put, and delete requests > are allowed.): > > Any idea whay this is?In your routes file you defined that you only wanted GET requests two the states action. Currently it doesn''t work since Prototype makes POST requests by default. You have two opportunities: A) Correct your routes file: map.resources "parties" , :controller=> "political_parties" , :collection => {:states => :post , :nationals => :get } B) Correct the link: <%= link_to_remote "State Parties" , :url=> states_parties_path, :update => {:success => ''parties_list''}, :method => :get %> The ActionController::MethodNotAllowed error in general means that you have attempted to call an action that is not allowed to be called with that method. E.g. you can''t POST to the show action, it only allows GET. -- Cheers, David Knorr http://twitter.com/rubyguy --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---