Skip to content

Instantly share code, notes, and snippets.

@ehoch
Created February 7, 2012 19:12
Show Gist options
  • Save ehoch/1761304 to your computer and use it in GitHub Desktop.
Save ehoch/1761304 to your computer and use it in GitHub Desktop.
Spam Action on the Fly
config.actions do
member :spam do
link_icon 'icon-ban-circle'
bulkable? { true }
controller do
Proc.new do
if params[:bulk_ids]
params[:bulk_ids].each {|id| @abstract_model.model.find(id).spam }
flash[:success] = "#{params[:bulk_ids].size} Spammed"
else
@object.spam
flash[:success] = "Deleted and Marked as spam."
end
redirect_to back_or_index
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment