Let’s say we have @posts = Post.published.per(10).page(params[:page]) somewhere in our controller. Later on we need to update all published posts (Post.published).
How should one remove the pagination?
@posts.limit(false).offset(false) seems to do the trick but I think there should be some other way, a more high-level way (something like @posts.without_pagination).
As the
pagemethod is provided by kaminari, I do not sure if kaminari provide also something likewithout_pagination.But if you like, you could always do this:
or you could extract the method out to a module and include the module into ActiveRecord::Base so that every model has the method.
Edited
Thank you tfwright for pointing out. Could use
.except(:limit, :offset)which should be much better for later comers.