Module: ActiveAdmin::BatchActions::Controller

Defined in:
lib/active_admin/batch_actions/controller.rb

Instance Method Summary collapse

Instance Method Details

#batch_actionObject

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



6
7
8
9
10
11
12
13
14
# 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

#selected_batch_actionObject (protected)



18
19
20
21
# 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