I seem to be stuck on restful deletion. I''ve got a person model and a wish model, a person has many wishes. Here''s my routes.rb (simplified) map.resources :people do |people| people.resources :wishes end Now I want to be able to delete a wish, and I try a link to person_wish_url(@wish.person, @wish, :method => :delete) But the generated path doesn''t seem to be recognized. shadowfax:~/ssanta rick$ script/console Loading development environment (Rails 2.0.0)>> include ActionController::UrlWriter=> Object>> person_wish_path(1, 2)=> "/people/1/wishes/2">> person_wish_path(1, 2, :method => :delete)=> "/people/1/wishes/2?method=delete">> irb ActionController::Routing::Routes >> recognize_path("/people/1/wishes/2")ActionController::MethodNotAllowed: Only get, put, and delete requests are allowed. from /Users/rick/ssanta/vendor/rails/actionpack/lib/action_controller/routing.rb:1436:in `recognize_path'' from (irb#1):1>> recognize_path("/people/1/wishes/2?method=delete")ActionController::RoutingError: No route matches "/people/1/wishes/2?method=delete" with {} from /Users/rick/ssanta/vendor/rails/actionpack/lib/action_controller/routing.rb:1438:in `recognize_path'' from (irb#1):2>> recognize_path("/people/1/wish/2?method=delete")ActionController::RoutingError: No route matches "/people/1/wish/2?method=delete" with {} from /Users/rick/ssanta/vendor/rails/actionpack/lib/action_controller/routing.rb:1438:in `recognize_path'' from (irb#1):3>>Where am I going wrong? -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.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 12/10/07, Rick DeNatale <rick.denatale-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I seem to be stuck on restful deletion.By the way: shadowfax:~/ssanta rick$ rake routes | grep wish person_wishes GET /people/:person_id/wishes {:controller=>"wishes", :action=>"index"} formatted_person_wishes GET /people/:person_id/wishes.:format {:controller=>"wishes", :action=>"index"} POST /people/:person_id/wishes {:controller=>"wishes", :action=>"create"} POST /people/:person_id/wishes.:format {:controller=>"wishes", :action=>"create"} new_person_wish GET /people/:person_id/wishes/new {:controller=>"wishes", :action=>"new"} formatted_new_person_wish GET /people/:person_id/wishes/new.:format {:controller=>"wishes", :action=>"new"} edit_person_wish GET /people/:person_id/wishes/:id/edit {:controller=>"wishes", :action=>"edit"} formatted_edit_person_wish GET /people/:person_id/wishes/:id/edit.:format {:controller=>"wishes", :action=>"edit"} person_wish GET /people/:person_id/wishes/:id {:controller=>"wishes", :action=>"show"} formatted_person_wish GET /people/:person_id/wishes/:id.:format {:controller=>"wishes", :action=>"show"} PUT /people/:person_id/wishes/:id {:controller=>"wishes", :action=>"update"} PUT /people/:person_id/wishes/:id.:format {:controller=>"wishes", :action=>"update"} DELETE /people/:person_id/wishes/:id {:controller=>"wishes", :action=>"destroy"} DELETE /people/:person_id/wishes/:id.:format {:controller=>"wishes", :action=>"destroy"} And this is on Rails 2.0 -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.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 -~----------~----~----~----~------~----~------~--~---
I figured it out, the method doesn''t go inside the x_path/x_url call, but as an option to the link_to D''oh! -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.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 -~----------~----~----~----~------~----~------~--~---