When I use Kaminari gem with the code:
Model:
def index
@posts = Post.page(params[:page])
end
And use it in index.html.erb:
It prints the next error:
undefined method `paginate' for #<#<Class:0x000000029bbd68>:0x000000029b3dc0>
red line on <%= paginate @posts %>
.
How can I fix this problem? Is my @posts paginable? I think yes.
If it's in the Gemfile, then you just need to run bundle install
instead of gem install Kaminari
. I would then restart my rails server to ensure its initializers are run to properly require its files.