module ActiveAdmin::BatchActions::Controller

Public Instance Methods

batch_action() click to toggle source

Controller Action that get's called when submitting the batch action form

# File lib/active_admin/batch_actions/controller.rb, line 6
def batch_action
  if selected_batch_action
    selected_ids = params[:collection_selection]
    selected_ids ||= []
    instance_exec selected_ids, &selected_batch_action.block
  else
    raise "Couldn't find batch action \"#{params[:batch_action]}\""
  end
end

Protected Instance Methods

selected_batch_action() click to toggle source
# File lib/active_admin/batch_actions/controller.rb, line 18
def selected_batch_action
  return unless params[:batch_action].present?
  active_admin_config.batch_actions.select { |action| action.sym == params[:batch_action].to_sym }.first
end