An open API service indexing awesome lists of open source software.

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.

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