-
Notifications
You must be signed in to change notification settings - Fork 330
API: Delete
scambra edited this page Sep 14, 2010
·
11 revisions
The action link used to tie the Delete action to the List table. See API: Action Link for the options on this setting.
Active scaffold supports html, js, json, yaml, and xml formats by default. If you need to add another mime type for the delete action you can do it here. The format is then added to the default formats.
Examples:
# Add a column (virtual, probably) config.delete.formats << :pdf or config.delete.formats = [:pdf]
If you need to perform some operation before deleting a record, you can override the do_destroy method. After performing your operations, simply call super to return to the ActiveScaffold delete operations.
Example:
In this example we want to log the destroy to a log table.
class ProspectsController < ApplicationController def do_destroy record = Prospect.find_by_id(params[:id]) log = Log.create(:description => "Deleted prospect #{record.name}", :created_by => current_user.name) log.save super end end