module ActiveAdmin::BatchActions::Controller

def batch_action

Controller action that is called when submitting the batch action form
def batch_action
  if action_present?
    selection = params[:collection_selection] || []
    inputs = JSON.parse(params[:batch_action_inputs].presence || "{}")
    instance_exec selection, inputs, &current_batch_action.block
  else
    raise "Couldn't find batch action \"#{params[:batch_action]}\""
  end
end