Here’s error and my codes. I’m using Kaminari
Error: undefined method `model_name' for #<Array:0x0000001d5abeb0>
73: <%= page_entries_info(@communities).html_safe %>
view
<%= page_entries_info(@communities).html_safe %>
Community controller
UPDATE* This is how I’m fetching now
@search = Community.search do
fulltext params[:search]
with(:location_id, params[:location]) if params[:location].to_i >0
with(:type_id, params[:type]) if params[:type].to_i >0
order_by :cached_votes_up, :desc
paginate :page => params[:page], :per_page => 10
end
@communities = @search.results
If you are using kaminari and will_paginate together, you will definitely face this error. In short, kaminari and will_paginate are incompatible to each other.
If you are using
rails_admin(which uses kaminari for pagination) and also usingwill_paginate, you will need to add the following code to one of the initializers under config directory or you can create a new file, let say with name ‘will_paginate’ add the code, and place it into initializers directory.