On Aug 10, 2009, at 11:58 AM, Ryan Bates wrote: > > +1 for the GET request on a delete action to show a confirmation > dialog. Also if you send a DELETE call to this URL it could trigger > the destroy action directly. This way it conveniently degrades nicely > with javascript. > > <%= link_to "Destroy", delete_item_path(item), :method > => :delete, :confirm => "Are you sure?" %> > > GET /items/1/delete # => maps to delete action with confirmation > screen > DELETE /items/1/delete # => maps to destroy action > > If javascript is disabled it will fall back to a GET request and > therefore display a confirmation screen.
That's very tidy, +1 on that specific permutation. I presume the idea would be to have DELETE /items/1 still mapping to destroy as well, for backwards compat (with a deprecation notice). If not - then -1 :) > Having this defined by default in map.resources would be convenient > and won't get in the way if not used. Whether or not scaffolding takes > advantage of this I don't care. I think if you make it like this then you need to have scaffolding support it - otherwise (I think) you'll get a missing template error when JS is disabled, which is untidy -> "Won't somebody PLEASE think of the newbs?!?" +1 for scaffolding support. Cheers, Jason --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---