This project is archived and is in readonly mode.
[PATCH] Non JavaScript dependent record deletion solution
-
Rizwan Reza
I remember Yehuda had said something about this in his presentation at Railsconf. Rails is going to handle this through HTML5, I guess.
-
Kieran P
Even with HTML5, I don't see a way of providing Javascript independent record deletion without either adding a delete method (as the patch does) or hacking the destroy method (which seems ugly to me).
At least with the delete method, you can add logic to check if it can be deleted before hitting the destroy action (as is needed in a project I'm working on).
-
Jeremy Kemper
- State changed from new to wontfix
Nice patch. I'm not a fan of adding a million delete confirmation pages, esp. in core. This would make a great plugin, however!
-
Jeremy Kemper
- Tag changed from bugmash, delete, destroy, javascript, rails, scafold to delete, destroy, javascript, rails, scafold
-
Elad Meidar
- Tag changed from delete, destroy, javascript, rails, scafold to bugmash, delete, destroy, javascript, rails, scafold
-1 i think it's better to leave it out, assuming that you add a delete method is somewhat not so RESTful imo. if there is a planned solution for a later version of rails based on HTML5 (whenever that's gonna be widely supported) i think it's better to keep it as it is atm.
-
Jeremy Kemper
- Tag changed from bugmash, delete, destroy, javascript, rails, scafold to delete, destroy, javascript, rails, scafold
-
Kieran P
- Tag changed from delete, destroy, javascript, rails, scafold to bugmash, delete, destroy, javascript, rails, scafold
Jeremy, its not a million confirmation pages. If Javascript is enabled, it continue to do the prompt/destroy functionality. It'll only render the delete action if they have JavaScript off when they click the Delete link.
Elad, whats not restful about it?
new -> create
edit -> update
delete -> destroyI'd be interested to hear how HTML5 will fix the issue... I suspect it'll just make the HTML easier to plugin into with Javascript and not actually fix the problem.
-
Jeremy Kemper
- Tag changed from bugmash, delete, destroy, javascript, rails, scafold to delete, destroy, javascript, rails, scafold
It's a delete route, action, and view on every controller and it begs for confusion with destroy.
(HTML5 has no bearing here.)
-
Erik Ostrom
FYI, Rails Magazine #2 (http://railsmagazine.com/issues/2) explains the HTML 5 thing. It doesn't eliminate the JavaScript dependency.
I'm +1 on eliminating the JavaScript dependency for delete, but I'm -1 pessimistic about the non-JavaScript scaffolding being maintained effectively.
http://www.napcsweb.com/blog/2009/07/01/accessible-rails-apps-rails... suggests another option: use button_to to generate a form consisting of hidden fields and a destroy button, and then use unobtrusive JavaScript to turn the form into a link for JS-enabled users.
I can imagine hacking link_to(..., :method => :delete) to do this automatically, but I'm not offering to do it.
