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 ...
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?
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/
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?
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.