Sha256: 3892f8b5d823c6878c79099ce03a7adf860752ca2e9606c4910389f7f3d967a4

Contents?: true

Size: 706 Bytes

Versions: 57

Compression:

Stored size: 706 Bytes

Contents

module ActiveAdmin
  module BatchActions
    module Controller

      # Controller Action that get's called when submitting the batch action form
      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

      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

    end
  end
end

Version data entries

57 entries across 57 versions & 3 rubygems

Version Path
lalala-4.0.0.dev.118 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.116 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.114 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.113 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.111 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.109 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.107 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.94 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.92 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.90 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.84 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.80 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.79 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.78 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.77 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.74 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.73 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.72 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.71 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb
lalala-4.0.0.dev.66 vendor/deps/active_admin/lib/active_admin/batch_actions/controller.rb