desbest
2013-Oct-24 20:47 UTC
undefined method `paginate'' for #<Class:0x567eb98> in Rails Tutorial
Hi, I''m getting a undefined method `paginate'' for #<Class:0x567eb98> even though I have gem ''will_paginate'' installed. Inside the users_controller I have @users = User.paginate(page: params[:page ]) so I believe I set everything up to be correct. Can you figure out why the method''s undefined, despite installing the gem? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/9797759a-d807-468f-960d-4447b76b8a00%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Colin Law
2013-Oct-24 21:17 UTC
Re: undefined method `paginate'' for #<Class:0x567eb98> in Rails Tutorial
On 24 October 2013 21:47, desbest <afaninthehouse-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi, > I''m getting a undefined method `paginate'' for #<Class:0x567eb98> even though > I have gem ''will_paginate'' installed. > Inside the users_controller I have @users = User.paginate(page: > params[:page]) > so I believe I set everything up to be correct. > Can you figure out why the method''s undefined, despite installing the gem?Which version of Rails are you using? If Rails 2 have you referenced will_paginate in environment.rb, if rails 3 have you put it in your Gemfile and run bundle install? Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsuuf8hyRuxsS58BfYg%3DHWaDu2V3DQ6k%2BLBSZFm8SMuDg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
tynamite
2013-Oct-24 22:11 UTC
Re: undefined method `paginate'' for #<Class:0x567eb98> in Rails Tutorial
I''m using Rails 3 and I''ve ran bundle install and put it in my Gemfile. On 24 October 2013 22:17, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote:> On 24 October 2013 21:47, desbest <afaninthehouse-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Hi, > > I''m getting a undefined method `paginate'' for #<Class:0x567eb98> even > though > > I have gem ''will_paginate'' installed. > > Inside the users_controller I have @users = User.paginate(page: > > params[:page]) > > so I believe I set everything up to be correct. > > Can you figure out why the method''s undefined, despite installing the > gem? > > Which version of Rails are you using? If Rails 2 have you referenced > will_paginate in environment.rb, if rails 3 have you put it in your > Gemfile and run bundle install? > > Colin > > -- > 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-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To view this discussion on the web visit > https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsuuf8hyRuxsS58BfYg%3DHWaDu2V3DQ6k%2BLBSZFm8SMuDg%40mail.gmail.com > . > For more options, visit https://groups.google.com/groups/opt_out. >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAEZ7cNMs-zs7x2-rms45XmgmPJuSTng987Fqn2vUvjo5WD0E9g%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
Frederick Cheung
2013-Oct-25 08:07 UTC
Re: undefined method `paginate'' for #<Class:0x567eb98> in Rails Tutorial
On Thursday, October 24, 2013 11:11:33 PM UTC+1, desbest wrote:> > I''m using Rails 3 and I''ve ran bundle install and put it in my Gemfile. > >And you restarted the app after doing this? Fred> > On 24 October 2013 22:17, Colin Law <cla...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org <javascript:>>wrote: > >> On 24 October 2013 21:47, desbest <afanint...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> >> wrote: >> > Hi, >> > I''m getting a undefined method `paginate'' for #<Class:0x567eb98> even >> though >> > I have gem ''will_paginate'' installed. >> > Inside the users_controller I have @users = User.paginate(page: >> > params[:page]) >> > so I believe I set everything up to be correct. >> > Can you figure out why the method''s undefined, despite installing the >> gem? >> >> Which version of Rails are you using? If Rails 2 have you referenced >> will_paginate in environment.rb, if rails 3 have you put it in your >> Gemfile and run bundle install? >> >> Colin >> >> -- >> 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...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org <javascript:>. >> To post to this group, send email to rubyonra...-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<javascript:> >> . >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsuuf8hyRuxsS58BfYg%3DHWaDu2V3DQ6k%2BLBSZFm8SMuDg%40mail.gmail.com >> . >> For more options, visit https://groups.google.com/groups/opt_out. >> > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/cbe7e318-90b8-4a98-9ab3-f66962c5863d%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Colin Law
2013-Oct-25 09:12 UTC
Re: undefined method `paginate'' for #<Class:0x567eb98> in Rails Tutorial
On 24 October 2013 23:11, tynamite <afaninthehouse-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I''m using Rails 3 and I''ve ran bundle install and put it in my Gemfile.Please don''t top post, it makes it difficult to follow the thread. Insert your reply inline. Thanks. Hopefully you mean that you have put it in Gemfile and run bundle install :) What does it show for paginate in Gemfile.lock? Copy/paste the full error output here and the section of the controller file containing the line giving the problem. Give us a line number in the file so we can cross reference to the error. Colin> > > On 24 October 2013 22:17, Colin Law <clanlaw-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org> wrote: >> >> On 24 October 2013 21:47, desbest <afaninthehouse-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> > Hi, >> > I''m getting a undefined method `paginate'' for #<Class:0x567eb98> even >> > though >> > I have gem ''will_paginate'' installed. >> > Inside the users_controller I have @users = User.paginate(page: >> > params[:page]) >> > so I believe I set everything up to be correct. >> > Can you figure out why the method''s undefined, despite installing the >> > gem? >> >> Which version of Rails are you using? If Rails 2 have you referenced >> will_paginate in environment.rb, if rails 3 have you put it in your >> Gemfile and run bundle install?-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsg5fpaJXBUHJrVTOAk_jJSyVgAFZjSy%3D3gSxYS5ytcgA%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
desbest
2013-Oct-25 15:45 UTC
Re: undefined method `paginate'' for #<Class:0x567eb98> in Rails Tutorial
On Friday, October 25, 2013 10:12:01 AM UTC+1, Colin Law wrote:> On 24 October 2013 23:11, tynamite <afanint...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> > wrote: > > I''m using Rails 3 and I''ve ran bundle install and put it in my Gemfile. > > Please don''t top post, it makes it difficult to follow the thread. > Insert your reply inline. Thanks. > > Hopefully you mean that you have put it in Gemfile and run bundle install > :) > What does it show for paginate in Gemfile.lock? > > Copy/paste the full error output here and the section of the > controller file containing the line giving the problem. Give us a > line number in the file so we can cross reference to the error. > > Colin > > > > > > > On 24 October 2013 22:17, Colin Law <cla...-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org <javascript:>> > wrote: > >> > >> On 24 October 2013 21:47, desbest <afanint...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org <javascript:>> > wrote: > >> > Hi, > >> > I''m getting a undefined method `paginate'' for #<Class:0x567eb98> even > >> > though > >> > I have gem ''will_paginate'' installed. > >> > Inside the users_controller I have @users = User.paginate(page: > >> > params[:page]) > >> > so I believe I set everything up to be correct. > >> > Can you figure out why the method''s undefined, despite installing the > >> > gem? > >> > >> Which version of Rails are you using? If Rails 2 have you referenced > >> will_paginate in environment.rb, if rails 3 have you put it in your > >> Gemfile and run bundle install? > >Gemfile.lock says bootstrap-will_paginate (0.0.9) will_paginate will_paginate (3.0.4) under GEM and will_paginate (= 3.0.4) under dependencies. I restarted the app using rails server and it didn''t work, but when I restarted my computer it started to work. Thanks for your help. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/1c6ffbf4-67d3-46da-b672-94e9c6a5afa6%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
Kashif Umair Liaqat
2013-Oct-27 04:16 UTC
Re: undefined method `paginate'' for #<Class:0x567eb98> in Rails Tutorial
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. On Friday, October 25, 2013 1:47:19 AM UTC+5, desbest wrote:> > Hi, > I''m getting a undefined method `paginate'' for #<Class:0x567eb98> even > though I have gem ''will_paginate'' installed. > Inside the users_controller I have @users = User.paginate(page: params[ > :page]) > so I believe I set everything up to be correct. > Can you figure out why the method''s undefined, despite installing the gem? >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/2390d463-501b-4ed3-8c26-2448d2b05544%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.