简体   繁体   中英

undefined method `page' for #<ActiveRecord::Relation:0xaadc8d4>

Im trying to install Kaminari pagination on rails 3 with adminpanel RailsAdmin, but I get this error:

NoMethodError in ShowsController#
undefined method `page' for # < ActiveRecord::Relation:0xaadc8d4>

Do you also have the gem "will_paginate" in use?

Check the file Gemfile.lock to see if you have this gem in use as well:

grep will_paginate Gemfile.lock

If that's the case, all you have to do is to create the file "config/initializers/kaminari.rb" and write this content on the file:

Kaminari.configure do |config|
  config.page_method_name = :per_page_kaminari
end

that should fix the issue

In my case I forgot to add the kaminari gem to my Gemfile :facepalm:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM