ruby-on-railsruby-on-rails-3kaminaripagination

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>

Solution

  • 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