Sha256: d8631f587773366bee74e638439dd40d9b24e607fc7e97069c244830b00fa641
Contents?: true
Size: 887 Bytes
Versions: 5
Compression:
Stored size: 887 Bytes
Contents
module ActiveAdmin module BatchActions module Controller # 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] || '{}' inputs = inputs.with_indifferent_access.slice *current_batch_action.inputs.keys instance_exec selection, inputs, ¤t_batch_action.block else raise "Couldn't find batch action \"#{params[:batch_action]}\"" end end protected def action_present? params[:batch_action].present? && current_batch_action end def current_batch_action active_admin_config.batch_actions.detect{ |action| action.sym.to_s == params[:batch_action] } end end end end
Version data entries
5 entries across 5 versions & 2 rubygems