I’m using the gem called ‘acts_as_follower’ and ‘kaminari’.
If I put .page(params[:page]).per(10) in the end of the line that fetches records with acts_as_follower, it gives back error. So I removed it.
How can I use pagination with this gem ‘acts_as_follower’?
Error
NoMethodError in UsersController#following
undefined method `page' for #<Array:0x00000018593928>
Extracted source (around line #53):
50: <% end %>
51:
52: <div class='pagination'>
53: <%= page_entries_info(@users).html_safe %>
54: <%= paginate @users, :window => 4, :outer_window => 5, :left => 2, :right => 2 %>
55: </div>
56:
current users_controller.rb Fetching part
@users = User.find_by_username(params[:id]).all_following(order: 'updated_at DESC')
Since the
all_following(order: 'updated_at DESC')method returns an array object, you’d need to use Kaminari’sPaginatableArray.Add the code below to your controller:
Then the pagination should work as you’d expect.