To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsuuf8hyRuxsS58BfYg%3DHWaDu2V3DQ6k%2BLBSZFm8SMuDg%40mail.gmail.com.
--
You received this message because you are subscribed to a topic in the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rubyonrails-talk/LeSOBxXc_70/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
I'm using Rails 3 and I've ran bundle install and put it in my Gemfile.
Gemfile.lock says
bootstrap-will_paginate (0.0.9)
will_paginate (3.0.4)
I am a little late in discussion but I've the solution to the problem :)
If you are using rails 4 then try this.
@users = User.all.paginate(page: params[:page]
Note that User.all will be an ActiveRelation
on which paginate
method works.
If you are using rails 3 then try this.
@users = User.where('').paginate(page: params[:page])
The reason to use an empty where is because where will return the ActiveRelation
which is more efficient instead of loading an array using User.all
.
Note that User.all
will return ActiveRelation
in rails 4 and in rails 3 it will return an Array
.