Will_paginate problem

my problem is not solved till now…
my configaration is like that

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”
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 }

CODE in MODELS list.rb is below

class List < ActiveRecord::Base
cattr_reader :per_page
@@per_page = 2


CODE in VIEWS index.html.erb is below

Listing lists

<% @lists.each do |list| %>

<% end %>
Name Pin
<%=h list.name %> <%=h list.pin %> <%= link_to 'Show', list %> <%= link_to 'Edit', edit_list_path(list) %> <%= link_to 'Destroy', list, :confirm => 'Are you sure?', :method => :delete %>

<%= 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

rails_apps\pagination>ruby script/server

=> Booting Mongrel
=> Rails 2.3.8 application starting on
=> Call with -d to detach
=> Ctrl-C to shutdown server

finally on browser error is coming this

undefined method `paginate’ for #Class:0x471c448

RAILS_ROOT: C:/InstantRails-2.0-win_2/rails_apps/pagination
Application Trace <?ui=2&view=bsp&ver=ohhl4rw8mbn4#12aa42c2d1daad4d_>
| Framework
Trace <?ui=2&view=bsp&ver=ohhl4rw8mbn4#12aa42c2d1daad4d_> | Full

method_missing' C:/InstantRails-2.0-win_2/rails_apps/pagination/app/controllers/lists_controller.rb:6:inindex’

please help me


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs