user1879099
user1879099

Reputation: 43

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>

Upvotes: 4

Views: 5195

Answers (2)

Dorian
Dorian

Reputation: 9185

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

Upvotes: 0

rorra
rorra

Reputation: 9693

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

Upvotes: 5

Related Questions