hello my problem is not solved till now… my configaration is like that
C:\InstantRails-2.0-win_2\
rails_apps\pagination>gem list will_paginate
*** LOCAL GEMS ***
will_paginate (2.3.14)
C:\InstantRails-2.0-win_2\rails_apps\pagination>gem list ruby
*** LOCAL GEMS ***
rubygems-update (1.3.7, 1.0.1)
C:\InstantRails-2.0-win_2\rails_apps\pagination>gem list rails
*** LOCAL GEMS ***
rails (2.3.8, 2.0.2)
I had made a fresh project of name “pagination”, table name is “lists” and attributes is name & pin
CODE in lists_controller is below
def index
#@lists = List.all
@lists = List.paginate :page => params[:page], :order => 'name DESC'
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @lists }
end
CODE in MODELS list.rb is below
class List < ActiveRecord::Base cattr_reader :per_page @@per_page = 2
end
CODE in VIEWS index.html.erb is below
Listing lists
<% @lists.each do |list| %>
<td><%=h list.pin %></td>
<td><%= link_to 'Show', list %></td>
<td><%= link_to 'Edit', edit_list_path(list) %></td>
<td><%= link_to 'Destroy', list, :confirm => 'Are you sure?', :method => :delete %></td>
<% end %>
| Name | Pin |
|---|---|
| <%=h [list.name](http://list.name/) %> |
<%= will_paginate @lists%>
<%= link_to ‘New list’, new_list_path %>
i had added in ENVIRNMENT.RB file
require ‘will_paginate’ at last end
when i am running server then
C:\InstantRails-2.0-win_2
rails_apps\pagination>ruby
script/server
=> Booting Mongrel => Rails 2.3.8 application starting on http://0.0.0.0:3000
=> Call with -d to detach => Ctrl-C to shutdown server
undefined method `paginate' for #<Class:0x471c448>
RAILS_ROOT: C:/InstantRails-2.0-win_2/rails_apps/pagination
Application Trace | Framework Trace | Full Trace
C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.8/lib/active_record/base.rb:1994:in `method_missing'
C:/InstantRails-2.0-win_2/rails_apps/pagination/app/controllers/lists_controller.rb:6:in `index'
please help me
thanks
finally on browser error is coming this