Pagination doesn't work with will_paginate. Could anyone help with this?

I am currently using Rails 2.3.5. I installed will_paginate gem 2.3.16
as suggested in the will_paginate github page. But will_paginate is
not being recognized when I use it and I always end up with an
error.The following are the error when used from the project console
and have also included my gem list.

Loading development environment (Rails 2.3.5)

paginate_test = Product.paginate(:page=>1)
NoMethodError: undefined method paginate' for #<Class:0x2bcee70> from D:/Program_Files/Ruby192/lib/ruby/gems/1.9.1/gems/ activerecord-2.3.5/lib/active_record/base.rb:1959:inmet
hod_missing’
from (irb):1
from D:/Program_Files/Ruby192/bin/irb:12:in `’


*** LOCAL GEMS ***

abstract (1.0.0)
actionmailer (3.0.9, 2.3.5, 2.3.4)
actionpack (3.0.9, 2.3.5, 2.3.4)
activemodel (3.0.9)
activerecord (3.0.9, 2.3.5, 2.3.4)
activeresource (3.0.9, 2.3.5, 2.3.4)
activesupport (3.0.9, 2.3.5, 2.3.4)
arel (2.1.4, 2.0.10)
Ascii85 (1.0.1)
builder (2.1.2)
bundler (1.0.15)
erubis (2.6.6)
hoe (2.10.0)
mail (2.2.19)
mime-types (1.16)
minitest (1.6.0)
mysql (2.8.1 x86-mingw32)
pdf-reader (0.10.0)
polyglot (0.3.1)
prawn (0.11.1)
rack (1.2.3, 1.0.1)
rack-mount (0.6.14)
rack-test (0.5.7)
rails (2.3.5, 2.3.4)
railties (3.0.9)
rake (0.8.7)
rdoc (3.8, 2.5.8)
sqlite3 (1.3.3 x86-mingw32)
test-unit (2.3.0, 1.2.3)
thor (0.14.6)
treetop (1.4.9)
ttfunk (1.0.1)
tzinfo (0.3.29)
will_paginate (2.3.16)

I missed that part initially, then added the following in my
environment.rb
config.gem ‘will_paginate’, :version => ‘~> 2.3.16
and tried running rake gem:install from the project directory.But I
ended up with the following error
rake aborted!
Don’t know how to build task ‘gem:install’
D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:1720:in []' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2040:in invoke_task’
D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in
block (2 levels) in top_level' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in each’
D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in
block in top_level' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in standard_exception_handling’
D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2013:in
top_level' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:1992:in run’
D:/Program_Files/Ruby192/bin/rake:31:in `’
But my rake -T has gem:install configured in it. I am operating behind
a proxy server, is that the reason?
If so what am i supposed to do?

On Aug 19, 12:10pm, Frederick C. [email protected]

On Aug 19, 7:49am, Rahul [email protected] wrote:

I am currently using Rails 2.3.5. I installed will_paginate gem 2.3.16
as suggested in the will_paginate github page. But will_paginate is
not being recognized when I use it and I always end up with an
error.The following are the error when used from the project console
and have also included my gem list.

Are you actually loading the will_paginate gem (i.e. by adding it to
your environment file or (if you are using bundler) by adding it to
your Gemfile and running bundle install ?

Fred

Going by memory here, but don’t you have to also add something to the
model to let Rails know that it can be paginated?

On Aug 19, 8:30am, Rahul [email protected] wrote:

I missed that part initially, then added the following in my
environment.rb
config.gem ‘will_paginate’, :version => '~> 2.3.16
and tried running rake gem:install from the project directory.But I
ended up with the following error

If the gem is install you don’t need to run gem:install. Don’t know
why it’s failing though

Fred

I was trying out the tutorials from railcast (http://railscasts.com/
episodes/51-will-paginate)
Nothing of that sort was mentioned…

Do you have in the model something like this:

cattr_reader :per_page
@@per_page = your-per-page-value

It’s been a while since I have setup anything with will_paginate but
if I have it in my models it is because I followed some instructions
from somewhere, probably either railscasts or the gem’s documentation
itself. It could be that things have changed since I used
will_paginate for the last time but I am pretty sure that your model
should ‘know’ somehow that it can be paginated.