Oct 2, 2014

Active Admin : Undefined Method `per' for #<ActiveRecord::Relation:> with will_paginate

If you are using both will_paginate and activeadmin, you may see an error like this:

Undefined Method `per' for #<ActiveRecord::Relation:0x.....>

This is because Active Admin uses kaminari for pagination. To fix this error make sure will_paginate and kaminari don't collide, as per : using active admin with will_paginate by adding some config to kaminari:

# create config/initializers/kaminari.rb
Kaminari.configure do |config|
  config.page_method_name = :per_page_kaminari
end

Google is likely to lead you to a github discussion that tells you to use a very specific version of will_paginate, but obviously the solution above is better.