Friday, July 29, 2011

Getting error "`const_missing': uninitialized constant ActiveRecord::Associations::AssociationCollection (NameError)"

-:restaurant ror$ rails s
/Users/ror/projects/restaurant/highline/ruby/1.9.1/bundler/gems/thinking-sphinx-ea7673a0188f/lib/thinking_sphinx/search.rb:623: warning: encoding option is ignored - u
=> Booting WEBrick
=> Rails 3.2.0.beta application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/ror/projects/restaurant/highline/ruby/1.9.1/gems/rake-0.9.2/lib/rake/ext/module.rb:36:in `const_missing': uninitialized constant ActiveRecord::Associations::AssociationCollection (NameError)
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/gems/will_paginate-3.0.pre2/lib/will_paginate/finders/active_record.rb:36:in `enable!'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/gems/will_paginate-3.0.pre2/lib/will_paginate/railtie.rb:9:in `block in <class:Railtie>'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/bundler/gems/rails-30dae273c85a/railties/lib/rails/initializable.rb:25:in `instance_exec'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/bundler/gems/rails-30dae273c85a/railties/lib/rails/initializable.rb:25:in `run'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/bundler/gems/rails-30dae273c85a/railties/lib/rails/initializable.rb:50:in `block in run_initializers'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/bundler/gems/rails-30dae273c85a/railties/lib/rails/initializable.rb:49:in `each'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/bundler/gems/rails-30dae273c85a/railties/lib/rails/initializable.rb:49:in `run_initializers'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/bundler/gems/rails-30dae273c85a/railties/lib/rails/application.rb:92:in `initialize!'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/bundler/gems/rails-30dae273c85a/railties/lib/rails/railtie/configurable.rb:30:in `method_missing'
    from /Users/ror/projects/restaurant/config/environment.rb:6:in `<top (required)>'
    from /Users/ror/projects/restaurant/config.ru:4:in `block in <main>'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/gems/rack-1.3.2/lib/rack/builder.rb:51:in `instance_eval'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/gems/rack-1.3.2/lib/rack/builder.rb:51:in `initialize'
    from /Users/ror/projects/restaurant/config.ru:1:in `new'
    from /Users/ror/projects/restaurant/config.ru:1:in `<main>'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/gems/rack-1.3.2/lib/rack/builder.rb:40:in `eval'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/gems/rack-1.3.2/lib/rack/builder.rb:40:in `parse_file'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/gems/rack-1.3.2/lib/rack/server.rb:200:in `app'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/bundler/gems/rails-30dae273c85a/railties/lib/rails/commands/server.rb:46:in `app'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/gems/rack-1.3.2/lib/rack/server.rb:301:in `wrapped_app'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/gems/rack-1.3.2/lib/rack/server.rb:252:in `start'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/bundler/gems/rails-30dae273c85a/railties/lib/rails/commands/server.rb:70:in `start'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/bundler/gems/rails-30dae273c85a/railties/lib/rails/commands.rb:54:in `block in <top (required)>'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/bundler/gems/rails-30dae273c85a/railties/lib/rails/commands.rb:49:in `tap'
    from /Users/ror/projects/restaurant/highline/ruby/1.9.1/bundler/gems/rails-30dae273c85a/railties/lib/rails/commands.rb:49:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Solution to fix the problem:

In my gemfile, I was using "will_paginate-3.0.pre2"

Fixed by changing will paginate version to pre4
gem 'will_paginate', '3.0.pre4'

No comments:

Post a Comment