https://github.com/amiel/delete_action
This rails plugin adds a delete action to the default map.resources routing set.
https://github.com/amiel/delete_action
Last synced: about 1 year ago
JSON representation
This rails plugin adds a delete action to the default map.resources routing set.
- Host: GitHub
- URL: https://github.com/amiel/delete_action
- Owner: amiel
- Created: 2010-08-24T16:52:40.000Z (almost 16 years ago)
- Default Branch: master
- Last Pushed: 2012-06-19T23:27:22.000Z (almost 14 years ago)
- Last Synced: 2024-10-03T12:33:13.557Z (over 1 year ago)
- Language: Ruby
- Homepage:
- Size: 89.8 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
Awesome Lists containing this project
README
== Delete Action
This rails plugin adds an extra action to the default `map.resources` routing set.
It is really just a shorthand for
map.resources :widgets, :member => { :delete => :get }
The idea is to have an action for a confirm delete form, which we tend to render in a modal.
This offers a similar user experience to link_to "widget", widget_url(widget), :method => :delete, :confirm => 'string' but allows for an unobtrusive case.
== Rails 3
See my blog post here: http://blog.amielmartin.com/post/1216720481/delete-action-in-rails-3
The next time I end up using this pattern I will probably come back and update this plugin...
== Example
map.resources :widgets
Will now map the following actions:
# GET widgets_url => index
# GET new_widget_url => new
# POST widgets_url => create
# GET widget_url(:id => 1) => show
# GET edit_widget_url(:id => 1) => edit
# PUT widget_url(:id => 1) => update
# GET delete_widget_url(:id => 1) => delete
# DELETE widget_url(:id => 1) => destroy