I'm using this successfully (in a Rails 2.3.5 app): link_to("Delete Post", post_path(@post), :confirm => 'Are you sure?', :method => :delete)
To my knowledge there is no such thing as a delete_XYZ_path. Check your logs to see if DELETE is really received on the top level. For debugging purposed try using curl: curl "localhost:3000/premises/ 123" -X DELETE Hope this helps! Simon On Jan 27, 2:32 am, Fearless Fool <li...@ruby-forum.com> wrote: > Marnen Laibow-Koser wrote in post #977756: > > >> The generated HTML is (for example): > > >> <a href="/premises/2" > >> data-confirm="Positive?" > >> data-method="delete" > >> rel="nofollow" > >> title="Delete 123 Chestnut Street">delete</a> > > >> That looks basically right to me, so I'm still stumped. > > > How can that look right to you? There's nothing telling Rails that you > > want DELETE or the destroy action. (The data-* attributes are > > client-side, and Rails will never see them.) > > Do you mean that the :method => :delete option has no effect on the > server? The documentation suggests something different. > > > What you need is something like destroy_premise_path(premise) for the > > URL in link_to -- check rake routes for the exact name. > > I thought the same thing, but rake routes gives me: > > premises GET /premises(.:format) {:action=>"index", > :controller=>"premises"} > POST /premises(.:format) {:action=>"create", > :controller=>"premises"} > new_premise GET /premises/new(.:format) {:action=>"new", > :controller=>"premises"} > edit_premise GET /premises/:id/edit(.:format) {:action=>"edit", > :controller=>"premises"} > premise GET /premises/:id(.:format) {:action=>"show", > :controller=>"premises"} > PUT /premises/:id(.:format) {:action=>"update", > :controller=>"premises"} > DELETE /premises/:id(.:format) {:action=>"destroy", > :controller=>"premises"} > > ... which, if I read this correctly, means that the delete path is still > just called "premise_path" -- the same as GET and PUT, but using a > :destroy method instead. > > So it still comes back to : how do I get link_to to generate a :destroy > action? I'm sure it's and obvious and stupid error on my part. (The > perplexing things is that I've done this lots of times before...) > > -- > Posted viahttp://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@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.