I am using kaminari and error.
Gemfile:
# gem 'will_paginate', '~> 3.0.6'
lists_controller.rb
def index if params[:tag] @lists = List.tagged_with(params[:tag]).order(created_at: :desc).paginate(page:params[:page], per_page: 3 ) else @lists = List.all.order(created_at: :desc) end end
I am also a user .page params[:page].per(2)
follows .order(created_at: :desc)
but does not work
Views / Lists / index.html.erb
<%= paginate @lists %>
mistake here
undefined method `total_pages' for #<List::ActiveRecord_Relation:0x007fa2303e3fa8> Extracted source (around line #26): </div> </div> <%= paginate @lists %> <div class="container"> <div class="row"> <div class="col-md-8">
I do not know how to do this, I copy railscasts about kaminari, and the video is Ok, I have an error. thanks, help me.
source share