class ActiveAdmin::BatchAction
Attributes
block[R]
confirm[R]
sym[R]
title[R]
Public Class Methods
new(sym, title, options = {}, &block)
click to toggle source
Create a Batch Action
Examples:
BatchAction.new :flag
> Will create an action that appears in the action list popover¶ ↑
BatchAction.new( :flag ) { |selection| redirect_to collection_path, :notice => "#{selection.length} users flagged" }
> Will create an action that uses a block to process the request (which receives one paramater of the selected objects)¶ ↑
BatchAction.new( "Perform Long Operation on the" ) { |selection| }
> You can create batch actions with a title instead of a Symbol¶ ↑
BatchAction.new( :flag, :if => proc { can? :flag, AdminUser } ) { |selection| }
> You can provide an optional :if proc to optionally display the batch action¶ ↑
# File lib/active_admin/batch_actions/resource_extension.rb, line 104 def initialize(sym, title, options = {}, &block) @sym, @title, @options, @block, @confirm = sym, title, options, block, options[:confirm] @block ||= proc {} end
Public Instance Methods
<=>(other)
click to toggle source
sort operator
# File lib/active_admin/batch_actions/resource_extension.rb, line 121 def <=>(other) self.priority <=> other.priority end
display_if_block()
click to toggle source
Returns the display if block. If the block was not explicitly defined a default block always returning true will be returned.
# File lib/active_admin/batch_actions/resource_extension.rb, line 111 def display_if_block @options[:if] || proc { true } end
priority()
click to toggle source
Used for sorting
# File lib/active_admin/batch_actions/resource_extension.rb, line 116 def priority @options[:priority] || 10 end