I have the following link_to: <%= link_to("Remove", {:action => "remove_role_from_account", :role_id => role, :account_id => @account}) %> It generates: http://myserver.com/roles/remove_role_from_account?account_id=1&role_id=5 But this doesn''t match the right default route: {:action=>"wsdl"} /:controller/:action/:id.:format /:controller/:action/:id So it''s not hitting my action "remove_role_from_account" and instead is try to go to action "show" with the id as "remove_role_from_account" what am i doing wrong here? -- 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 -~----------~----~----~----~------~----~------~--~---
On Sun, Dec 14, 2008 at 10:27 PM, Allen Walker < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > I have the following link_to: > > <%= link_to("Remove", {:action => "remove_role_from_account", :role_id > => role, :account_id => @account}) %> > > It generates: > http://myserver.com/roles/remove_role_from_account?account_id=1&role_id=5 > > But this doesn''t match the right default route: > > {:action=>"wsdl"} /:controller/:action/:id.:format > /:controller/:action/:id > > So it''s not hitting my action "remove_role_from_account" and instead is > try to go to action "show" with the id as "remove_role_from_account" > > what am i doing wrong here? > -- >what does the output of: rake routes look like? --wpd --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Patrick Doyle wrote:> On Sun, Dec 14, 2008 at 10:27 PM, Allen Walker < > rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > >> >> {:action=>"wsdl"} /:controller/:action/:id.:format >> /:controller/:action/:id >> >> So it''s not hitting my action "remove_role_from_account" and instead is >> try to go to action "show" with the id as "remove_role_from_account" >> >> what am i doing wrong here? >> -- >> > what does the output of: > > rake routes > > look like? > > --wpdroles GET /roles {:action=>"index", :controller=>"roles"} formatted_roles GET /roles.:format {:action=>"index", :controller=>"roles"} POST /roles {:action=>"create", :controller=>"roles"} POST /roles.:format {:action=>"create", :controller=>"roles"} new_role GET /roles/new {:action=>"new", :controller=>"roles"} formatted_new_role GET /roles/new.:format {:action=>"new", :controller=>"roles"} edit_role GET /roles/:id/edit {:action=>"edit", :controller=>"roles"} formatted_edit_role GET /roles/:id/edit.:format {:action=>"edit", :controller=>"roles"} role GET /roles/:id {:action=>"show", :controller=>"roles"} formatted_role GET /roles/:id.:format {:action=>"show", :controller=>"roles"} PUT /roles/:id {:action=>"update", :controller=>"roles"} PUT /roles/:id.:format {:action=>"update", :controller=>"roles"} DELETE /roles/:id {:action=>"destroy", :controller=>"roles"} DELETE /roles/:id.:format {:action=>"destroy", :controller=>"roles"} {:action=>"wsdl"} /:controller/:action/:id.:format /:controller/:action/:id -- 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 -~----------~----~----~----~------~----~------~--~---
> > > what does the output of: > > > > rake routes > > > > look like? > > > > --wpd > > roles GET /roles > {:action=>"index", :controller=>"roles"} > formatted_roles GET > /roles.:format > {:action=>"index", :controller=>"roles"} > POST /roles > {:action=>"create", :controller=>"roles"} > POST > /roles.:format > {:action=>"create", :controller=>"roles"} > new_role GET /roles/new > {:action=>"new", :controller=>"roles"} > formatted_new_role GET > /roles/new.:format > {:action=>"new", :controller=>"roles"} > edit_role GET > /roles/:id/edit > {:action=>"edit", :controller=>"roles"} > formatted_edit_role GET > /roles/:id/edit.:format > {:action=>"edit", :controller=>"roles"} > role GET /roles/:id > {:action=>"show", :controller=>"roles"} > formatted_role GET > /roles/:id.:format > {:action=>"show", :controller=>"roles"} > PUT /roles/:id > {:action=>"update", :controller=>"roles"} > PUT > /roles/:id.:format > {:action=>"update", :controller=>"roles"} > DELETE /roles/:id > {:action=>"destroy", :controller=>"roles"} > DELETE > /roles/:id.:format > {:action=>"destroy", :controller=>"roles"} > {:action=>"wsdl"} > > /:controller/:action/:id.:format > > /:controller/:action/:id > > In all my humble newbieness, it looks to me like, when you get a URL of theform /roles/something?with_this?and_that, the first pattern that the route table finds that matches that is the pattern that looks like: /roles/:id, so you get routed to the "show" action of the "roles"controller. I know that the routes table is processed in order and the first pattern that matches is the one that triggers the action (which is why the /:controller/:action/:id pattern is always listed last.). What I don''t know is, why does {:action => "remove_role_from_account", :role_id => role, :account_id => @account} produce a url of the form: /roles/remove_role_from_account, when you specifically plug in an action of "remove_role_from_account". Sorry if this doesn''t help much. --wpd --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---