# Will\_paginate

**URL:** <https://www.ruby-forum.com/t/will-paginate/193782>\
**Category:** Rails\
**Created:** [August 24, 2010, 9:54am UTC](https://www.ruby-forum.com/t/will-paginate/193782 "2010-08-24T09:54:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jeff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jeff](https://www.ruby-forum.com/u/jeff)\
**Post date:** [August 24, 2010, 9:54am UTC](https://www.ruby-forum.com/t/will-paginate/193782/1 "2010-08-24T09:54:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jeff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jeff](https://www.ruby-forum.com/u/jeff)\
**Post date:** [August 24, 2010, 10:02am UTC](https://www.ruby-forum.com/t/will-paginate/193782/2 "2010-08-24T10:02:51Z")

</div>

On Aug 24, 8:36 am, Jeff C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> ```
> #@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

---

<div class="post-metadata">

**Author:** ![jeff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jeff](https://www.ruby-forum.com/u/jeff)\
**Post date:** [August 25, 2010, 11:43am UTC](https://www.ruby-forum.com/t/will-paginate/193782/3 "2010-08-25T11:43:49Z")

</div>

Dear

On 8æœˆ24æ—¥, ä¸‹åˆ4æ™‚01åˆ†, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > Â Â # Â Â Â Â Â Â Â Â Â Â Â Â :per\_page =\> 10, :order =\> 'created\_at  
> > 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\> Thanks and Best Regards,
> 
> > Jeff

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

How to fix it? Thanks.

---

<div class="post-metadata">

**Author:** ![jeff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jeff](https://www.ruby-forum.com/u/jeff)\
**Post date:** [August 25, 2010, 12:00pm UTC](https://www.ruby-forum.com/t/will-paginate/193782/4 "2010-08-25T12:00:47Z")

</div>

On 25 Aug 2010, at 10:42, Jeff C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> 

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

Fred

---

<div class="post-metadata">

**Author:** ![jeff](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e19b73/32.png) [@jeff](https://www.ruby-forum.com/u/jeff)\
**Post date:** [August 26, 2010, 4:59am UTC](https://www.ruby-forum.com/t/will-paginate/193782/5 "2010-08-26T04:59:31Z")

</div>

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

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

On 8æœˆ25æ—¥, ä¸‹åˆ5æ™‚58åˆ†, Frederick C. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
