Using Rails & Kaminari gem, I am getting the below error when I render my view:
undefined method `total_pages' for #Array:0x007faa486583e0
controller:
def index
@user = current_shop.users.new
@users = current_shop.active_users ### This returns an array
Kaminari.paginate_array(@users).page(params[:page]).per(10)
end
view:
<tbody>
<%= paginate @users %>
<% @users.each do |user| %>
<%= render 'user_table_row', :user=> user %>
<% end %>
</tbody>
What am I doing wrong?
I think you have to assign
@users = Kaminari.paginate_array(@users).page(params[:page]).per(10)
in your controller.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With