I am trying to add Kaminari to my Rails application. I turned on the gem and here is what my controller looks like:
def index
if params[:year]
if params[:year].size > 0
@songs = Song.where("year like ?", params[:year]).page(params[:page])
elsif params[:artist].size > 0
@songs = Song.where("artist_name like ?", params[:artist]).page(params[:page])
elsif params[:song].size > 0
@songs = Song.where("title like ?", params[:song]).page(params[:page])
end
else
@songs = Song.first(10).page(params[:page])
end
end
and then adding
<%= paginate @songs %>
In my opinion, the error I get is:
undefined method `page' for #<Array:0x007fab0455b4a8>
Not sure why this happens when I executed the docs step for the step.
source
share