# Will\_paginate

**URL:** <https://www.ruby-forum.com/t/will-paginate/134685>\
**Category:** Rails\
**Created:** [April 14, 2008, 2:02am UTC](https://www.ruby-forum.com/t/will-paginate/134685 "2008-04-14T02:02:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lwlwlw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/3da27b/32.png) [@lwlwlw](https://www.ruby-forum.com/u/lwlwlw)\
**Post date:** [April 14, 2008, 2:02am UTC](https://www.ruby-forum.com/t/will-paginate/134685/1 "2008-04-14T02:02:06Z")

</div>

I’m trying to get some pagination to work (I’m just starting with  
rails). I’m using Rails 2.0.2 (Mac OS 10.5.2). I installed the  
will\_paginate gem, and it shows up as installed if I run ‘gem  
list’ … (will\_paginate (2.2.1)).

However, I’m getting an error anytime I try to use a paginate command  
like …

@articles = Article.paginate :page =\> params[:page]

NoMethodError: undefined method `paginate’ for #Class:0x114b7ec

I added ‘require “will\_paginate”’ to environment.rb, but it doesn’t  
seem to make any difference.

What’s the secret handshake required to get pagination to work with  
Rails 2.0.2? Is there a tutorial somewhere that shows all the  
required steps to get pagination (particularly, using will\_paginate)  
to work with 2.0.2?

-lw

---

<div class="post-metadata">

**Author:** ![lwlwlw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/3da27b/32.png) [@lwlwlw](https://www.ruby-forum.com/u/lwlwlw)\
**Post date:** [April 14, 2008, 2:58am UTC](https://www.ruby-forum.com/t/will-paginate/134685/2 "2008-04-14T02:58:46Z")

</div>

It seems you haven’t installed it as a plugin, or required it in your  
environment.

Also don’t forget to restart your webserver if you haven’t. 😉

Julian.

Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)  
VIDEO #4 coming soon!  
[http://sensei.zenunit.com/](http://sensei.zenunit.com/)

---

<div class="post-metadata">

**Author:** ![lwlwlw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/3da27b/32.png) [@lwlwlw](https://www.ruby-forum.com/u/lwlwlw)\
**Post date:** [April 14, 2008, 3:21am UTC](https://www.ruby-forum.com/t/will-paginate/134685/3 "2008-04-14T03:21:17Z")

</div>

Julian L. wrote:

> It seems you haven’t installed it as a plugin, or required it in your  
> environment.
> 
> Also don’t forget to restart your webserver if you haven’t. 😉
> 
> Julian.
> 
> Learn Ruby on Rails! Check out the FREE VIDS (for a limited time)  
> VIDEO #4 coming soon!  
> [http://sensei.zenunit.com/](http://sensei.zenunit.com/)

Hi,

I’ve the same error too. I have installed as a plugin and required it in  
my environment. But it doesn’t seems to work. I still get the  
NoMethodError. Can someone tell me how to solve this?

Thanks

---

<div class="post-metadata">

**Author:** ![lwlwlw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/3da27b/32.png) [@lwlwlw](https://www.ruby-forum.com/u/lwlwlw)\
**Post date:** [April 14, 2008, 7:16am UTC](https://www.ruby-forum.com/t/will-paginate/134685/4 "2008-04-14T07:16:31Z")

</div>

splash,

I discovered what the problem was (thanks to Julian). I had installed  
the gem correctly. The problem was that I had put the following  
statement…

require “will\_paginate”

_inside_ of “Rails::Initializer.run do |config|”, rather than  
_following_ the end of that block. When I moved the require statement  
to the end of the file (app/config/environment.rb), following the  
‘end’ of the block, the app was able to find the gem, and that error  
went away. I’ve got it sort of working now. I just need to work on  
setting up the partial rendering correctly.

-lw

On Apr 13, 6:21 pm, user splash [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)
