Last Updated: February 25, 2016
· demiazz

ActiveAdmin: batch actions for different scopes

If needed show some batch actions only with different scopes, we can use this dirty trick:

batch_action :action_name, if: proc { @current_scope.scope_method == :needed_scope } do |selection|

If you know more right and elegance method -tell me, please. (=

6 Responses
Add your response

I can't make it work with @currentscope.scopemethod, I am using activeadmin 0.5.0, which version are you using?

over 1 year ago ·

@jbala87 Hm. I'm using 0.5.0 too. Look at this example. and try bind pry in proc.

over 1 year ago ·

I haven't been able to get this to work either. @current_scope is coming back as nil.

over 1 year ago ·

It's really strange... This is code work for me. SCRATCH

over 1 year ago ·

@current_scope works for me with ActiveAdmin 0.6 and rails 4.

over 1 year ago ·

I was having the same problem. I solved it by specifing a default scope in the admin model, like this

scope :needed_scope, default: true

Rails 3.2.16 and last activeadmin master (

over 1 year ago ·