Will_paginate problem

Hi

I am using rails 2.3.8 & ruby 1.3.7 & will_paginate 2.3.14

I have table name books. I am doing this code for pagination,

In book_controller

@@@@books = Book.paginate :page => params[:page], :per_page => 10@@@@

& in index.html.erb

@@@@@<%= will_paginate @books %>@@@@@

Also added in environment.rb file this line

@@@@@ require ‘will_paginate’@@@@@

After adding this when I am running “””ruby script/server””” then this
error
is coming

@@@@@ NoMethodError in StoreController#index

undefined method `paginate’ for #Class:0x4aaf448

RAILS_ROOT: C:/InstantRails-2.0-win_2/rails_apps/diligence

Application Trace http://localhost:3000/store | Framework
Tracehttp://localhost:3000/store
| Full Trace http://localhost:3000/store

C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1532:in
`method_missing’

app/controllers/store_controller.rb:6:in `index’

@@@@@

When I am adding this line in environment.rb

@@@config.gem ‘mislav-will_paginate’ , :version => ‘~> 2.3.14’ ,

:lib => ‘will_paginate’ , :source => ‘http://gems.github.com’@@@@

then this error is coming

@@@

C:\InstantRails-2.0-win_2\rails_apps\diligence>ruby script/server

=> Booting Mongrel (use ‘script/server webrick’ to force WEBrick)

=> Rails application starting on http://0.0.0.0:3000

=> Call with -d to detach

=> Ctrl-C to shutdown server

** Starting Mongrel listening at 0.0.0.0:3000

** Starting Rails with development environment…

Exiting

C:/InstantRails-2.0-win_2/rails_apps/diligence/config/environment.rb:15:
private method `gem’ called for #Rails::Configuration:0x350767c
(NoMethodError)

    from

C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializer.rb:47:in
`run’

    from

C:/InstantRails-2.0-win_2/rails_apps/diligence/config/environment.rb:13

    from

C:/InstantRails-2.0-win_2/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require’

    from

C:/InstantRails-2.0-win_2/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require’

    from

C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in
`require’

    from

C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
`new_constants_in’

    from

C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:496:in
`require’

    from

C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.2-x86-mswin32/bin/…/lib/mongrel/rails.rb:147:in
`rails’

     ... 20 levels...

    from

C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/commands/server.rb:39

    from

C:/InstantRails-2.0-win_2/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require’

    from

C:/InstantRails-2.0-win_2/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require’

    from script/server:3

@@@@@

Please help me

thanks

gem install will_paginate
try again

On Tue, Aug 24, 2010 at 11:48 AM, pravin mishra <
[email protected]> wrote:

C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/lib/active_record/base.rb:1532:in `method_missing’

=> Booting Mongrel (use ‘script/server webrick’ to force WEBrick)

    from
    from

C:/InstantRails-2.0-win_2/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
@@@@@
[email protected][email protected]
.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.


Thanks:
Rajeev sharma

I had install “will_paginate 2.3.14”

On Aug 24, 7:18 am, pravin mishra [email protected]
wrote:

Hi

I am using rails 2.3.8 & ruby 1.3.7 & will_paginate 2.3.14

You’re not - the stack traces show you are running rails 2.0.2, which
may be part of the problem (eg config.gem was only added in 2.1)

Fred

thanks Frederick
below data is also trace from my window console…

C:\InstantRails-2.0-win_2\rails_apps\diligence>gem list rails

*** LOCAL GEMS ***

rails (2.3.8, 2.0.2)

C:\InstantRails-2.0-win_2\rails_apps\diligence>gem list ruby

*** LOCAL GEMS ***

rubygems-update (1.3.7, 1.0.1)

C:\InstantRails-2.0-win_2\rails_apps\diligence>gem list will_paginate

*** LOCAL GEMS ***

will_paginate (2.3.14)

what is going on i dot know, yesterday i had update all rails, ruby &
will_paginate.
May be any problem, it not woking properly, If know then help me

thanks

On 24 August 2010 09:28, pravin mishra [email protected]
wrote:

thanks Frederick
below data is also trace from my window console…

C:\InstantRails-2.0-win_2\rails_apps\diligence>gem list rails

*** LOCAL GEMS ***

rails (2.3.8, 2.0.2)

You have both versions installed, which is ok. Have a look in
config/environment.rb and you will find a line something like
RAILS_GEM_VERSION = ‘2.3.8’ unless defined? RAILS_GEM_VERSION
If that does not say 2.3.8 then change it to that and, in ruby console
do

rake rails:update

This will update the boot and so on to the latest version.
Make sure that you have committed your source to your version control
system (git or whatever) first so that you can see what has been
changed.

Colin

hi colin
I followed your instruction after that wen I am running my server then
this
error is coming…
here diligence is my project name

C:\InstantRails-2.0-win_2\rails_apps\diligence>ruby script/server
=> Booting Mongrel
=> Rails 2.3.8 application starting on http://0.0.0.0:3000
C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:602:in
send': undefined method cache_template_extensions=’ for
ActionView::Base:Cla
ss (NoMethodError)
from
C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:602:in
initialize_framework_settings' from C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:601:in each’
from
C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:601:in
initialize_framework_settings' from C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:598:in each’
from
C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:598:in
initialize_framework_settings' from C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:155:in process’
from
C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in
send' from C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in run’
… 6 levels…
from
C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/commands/server.rb:84
from
C:/InstantRails-2.0-win_2/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
gem_original_require' from C:/InstantRails-2.0-win_2/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in require’
from script/server:3

thanks
waiting for yr reply…

On 24 August 2010 10:25, pravin mishra [email protected]
wrote:

hi colin
I followed your instruction after that wen I am running my server then this
error is coming…
here diligence is my project name

Please don’t top post, insert your reply at the appropriate place in
the previous post. Another reader looking that this thread will ask
what instructions you followed, if you had inserted your reply after
my suggestions it would have been obvious.

C:\InstantRails-2.0-win_2\rails_apps\diligence>ruby script/server
=> Booting Mongrel
=> Rails 2.3.8 application starting on http://0.0.0.0:3000
C:/InstantRails-2.0-win_2/ruby/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:602:in
send': undefined method cache_template_extensions=’ for
ActionView::Base:Cla
ss (NoMethodError)

Google can be very useful for this sort of problem. I googled for
undefined method cache_template_extensions
and the first link was for this error occurring after an upgrade. The
solution for him was to remove the line from
config/environment/development.rb

Colin

On 24 August 2010 15:10, Colin L. [email protected] wrote:

what instructions you followed, if you had inserted your reply after

ActionView::Base:Cla

You received this message because you are subscribed to the Google G.
“Ruby on Rails: Talk” group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected][email protected]
.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

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

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

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

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 <#> | 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

On 24 August 2010 13:56, pravin mishra [email protected]
wrote:

[…]

i had added in ENVIRNMENT.RB file

require ‘will_paginate’

require is now out of obsolete, Instead use

config.gem ‘will_paginate’

in environment.rb inside the Initializer block.

Colin

On 24 August 2010 19:12, Colin L. [email protected] wrote:

=> Rails 2.3.8 application starting on http://0.0.0.0:3000
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected][email protected]
.
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.

thanks colin problem is solved