pagination

I want to do pagination in my project.For that i installed gem install mislav-will_paginate --source http://gems.github.com/ . then i wrote require 'will_paginate' in my enviornment.rb file. anything else required? Then am i able to use it for my application? how can i call it from my controller.I tried to call paginate..but error is showing that undefined method paginate.. can anybody help me?

then i wrote require 'will_paginate' in my enviornment.rb file. anything else required?

that's all to it. if you can start script/server and get no errors for it, it should be ok so far.

to actually paginate something do this (example for model named Product):

@products = Product.paginate(:all, :order => "products.created_at DESC",                                   :page => params[:page].to_i, :per_page => params[:per_page].to_i)

mind, that params[:page] & params[:per_page] should be initialized properly per_page should be 1 for first call and set to other pages for further calls. but will_paginate will handle most of it.

in the view you get the pagination links like that:   <% unless @products.nil? or @products.empty?%>       <%= will_paginate @products, :inner_window => 2 %>   <% else %>    found nothing   <% end %>

I got error like this... undefined method `paginate' for #<Class:0x466c408>

RAILS_ROOT: C:/InstantRails-2.0-win(3)/rails_apps/invictold Application Trace | Framework Trace | Full Trace

vendor/rails/activerecord/lib/active_record/base.rb:1667:in `method_missing' app/models/customer.rb:8:in `search' app/controllers/customers_controller.rb:6:in `index'

can anybody help me...

Classic pagination has been moved into a plugin since 2.0.