I like the idea of a small inline form for scaffolding. But I also REALLY like the idea of a standard HTML-only approach that supports confirmation: some resources are too important to delete without confirmation (or better yet, a "review" of the consequences), and counting on JavaScript is Bad.
+1 for GET /posts/1/delete +1 for small inline form in scaffolding that DELETE /posts/1 (without confirmation if deemed appropriate). -Chris On Aug 10, 7:43 am, Yehuda Katz <wyc...@gmail.com> wrote: > MatthewRudy wrote: > > I think this is something that is always annoying. > > Namely I have to reinvent a convention to handle this. > > > Something like "pre_delete" with a GET > > - this is just a proper delete form > > and "delete" with a DELETE > > - this does the delete > > > but I think we deserve to have this baked into rails. > > > I think it'd be cool if; > > GET /posts/delete mapped to the "pre-delete" action > > DELETE /posts/delete mapped to the "delete action" > > This doesn't make sense. The normal HTTP convention would be: > > DELETE /posts/1 to delete. > > I like the idea of: > > GET /posts/1/delete for a DELETE confirmation screen. You'd then have: > > --- > > GET /posts/1 to see the post > GET /posts/1/edit to get a screen with information on editing the post, > which: > PUT /posts/1 to update the post > > We also have: > > GET /posts to see all posts > GET /posts/new to get a screen with information on creating a new post, > which: > POST /posts to create it > > This would add: > > GET /posts/1/delete to get a screen with information on deleting the > post (a confirmation), which would: > DELETE /posts/1 to delete it > > > thereby, > > with a "link_to "delete", :method => :delete" > > you automatically fall back when javascript is disabled. > > > Boom. > > > On Aug 10, 1:20 am, Kieran P<kieran...@gmail.com> wrote: > > >> Hello, > > >> The generated scaffold relies on Javascript enabled to be able to > >> delete a record, which prevents anyone with JavasScript disabled to > >> delete it. > > >> I've hacked a solution with a delete action in one of my projects, > >> which works nicely, and cleanly. Basically, the link still have > >> Javascript which will work if enabled, but the url of the link goes to > >> a delete action, with a form that confirms the user wants to delete > >> (instead of a Javascript prompt). > > >> Only took 3 new controller lines, 6 new view lines, 1 changed view > >> line, and a route :member. > > >> Is this something that people would like to see in Rails 3? > > >> Regards > >> Kieran > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---