will_paginate

Dear Madam/ Sir,

This is my first post, and I am stuck it for many months.

I have below error msg:

NoMethodError (undefined method `paginate' for #<Class:0x640ccc4>):   app/controllers/manage_controller.rb:24:in `list'

Here is my code:

def list

    #@images = Image.paginate :page => params[:page], :per_page => 5     @items = Item.paginate :page => params[:page], :per_page => 5     #@items = Item.paginate(:page => params[:page], :per_page => 10)     #@user_pages, @users = paginate ( :users, :per_page => 5 )     #@babysitters = Babysitter.cached(:list).paginate(:page => params[:page],:per_page => 10)     # :per_page => 10, :order => 'created_at DESC'     #@users = User.paginate(:page => params[:page])     #@items = Item.paginate(:page => params[:page])     #@items = Item.paginate(:page => params[:page], :per_page => 5)     #@careers = Career.paginate :page => params[:page], :per_page => 10

  end

I did add require 'will_paginate' after the end of environment.rb, what else I can do now?

Thanks and Best Regards, Jeff

Dear Madam/ Sir,

This is my first post, and I am stuck it for many months.

I have below error msg:

NoMethodError (undefined method `paginate' for #<Class:0x640ccc4>): app/controllers/manage_controller.rb:24:in `list'

Here is my code:

def list

\#@images = Image\.paginate :page =&gt; params\[:page\], :per\_page =&gt; 5
@items = Item\.paginate :page =&gt; params\[:page\], :per\_page =&gt; 5
\#@items = Item\.paginate\(:page =&gt; params\[:page\], :per\_page =&gt; 10\)
\#@user\_pages, @users = paginate \( :users, :per\_page =&gt; 5 \)
\#@babysitters = Babysitter\.cached\(:list\)\.paginate\(:page =&gt;

params[:page],:per_page => 10) # :per_page => 10, :order => 'created_at DESC' #@users = User.paginate(:page => params[:page]) #@items = Item.paginate(:page => params[:page]) #@items = Item.paginate(:page => params[:page], :per_page => 5) #@careers = Career.paginate :page => params[:page], :per_page => 10

end

I did add require 'will_paginate' after the end of environment.rb, what else I can do now?

Don't do that - use config.gem to load gems (in 2,x that is - look at bundler if you are using rails 3)

Fred

Dear

I write the config.gem 'will_paginate' in the inside of environment.rb, but got below error msg:

undefined local variable or method 'config' for main Object <NameError>

How to fix it? Thanks.

You're probably putting it in the wrong place. What does your environment.rb look like

Fred

Yes, I put it before the end, then the <NameError> is passed.

But the undefined method `paginate' for #<Class:0x6782980> is happened again.