将分页冲突Rails 3.1.0.rc4

时间:2011-06-17 08:01:56

标签: ruby-on-rails-3 will-paginate

由于错误或与will_paginate gem冲突,我遇到了运行Rails 3.1.0.rc4应用程序的问题。

尝试启动服务器时产生的错误如下:

/Users/imac/.rvm/gems/ruby-1.9.2-p180@hbg_3.1/gems/will_paginate-2.3.15/lib/will_paginate.rb:39:in `enable_activerecord': uninitialized constant ActiveRecord::Associations::AssociationCollection (NameError)
    from /Users/imac/.rvm/gems/ruby-1.9.2-p180@hbg_3.1/gems/will_paginate-2.3.15/lib/will_paginate.rb:88:in `<top (required)>'
    from /Users/imac/.rvm/gems/ruby-1.9.2-p180@hbg_3.1/gems/bundler-1.0.15/lib/bundler/runtime.rb:68:in `require'
    from /Users/imac/.rvm/gems/ruby-1.9.2-p180@hbg_3.1/gems/bundler-1.0.15/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /Users/imac/.rvm/gems/ruby-1.9.2-p180@hbg_3.1/gems/bundler-1.0.15/lib/bundler/runtime.rb:66:in `each'
    from /Users/imac/.rvm/gems/ruby-1.9.2-p180@hbg_3.1/gems/bundler-1.0.15/lib/bundler/runtime.rb:66:in `block in require'
    from /Users/imac/.rvm/gems/ruby-1.9.2-p180@hbg_3.1/gems/bundler-1.0.15/lib/bundler/runtime.rb:55:in `each'
    from /Users/imac/.rvm/gems/ruby-1.9.2-p180@hbg_3.1/gems/bundler-1.0.15/lib/bundler/runtime.rb:55:in `require'
    from /Users/imac/.rvm/gems/ruby-1.9.2-p180@hbg_3.1/gems/bundler-1.0.15/lib/bundler.rb:120:in `require'
    from /Users/imac/railsprojects/hbg/config/application.rb:12:in `<top (required)>'
    from /Users/imac/.rvm/gems/ruby-1.9.2-p180@hbg_3.1/gems/railties-3.1.0.rc4/lib/rails/commands.rb:52:in `require'
    from /Users/imac/.rvm/gems/ruby-1.9.2-p180@hbg_3.1/gems/railties-3.1.0.rc4/lib/rails/commands.rb:52:in `block in <top (required)>'
    from /Users/imac/.rvm/gems/ruby-1.9.2-p180@hbg_3.1/gems/railties-3.1.0.rc4/lib/rails/commands.rb:49:in `tap'
    from /Users/imac/.rvm/gems/ruby-1.9.2-p180@hbg_3.1/gems/railties-3.1.0.rc4/lib/rails/commands.rb:49:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

1 个答案:

答案 0 :(得分:14)

我遇到了同样的问题。这似乎是一个已知的问题,很快就会修复:https://github.com/mislav/will_paginate/issues/124

您可以在此期间使用补丁:https://github.com/p7r/will_paginate/commit/53d1da6da003dc172ee054e4cc416d0723f00b88

或者,更好的是,在Gemfile中使用以下行:

gem "will_paginate", :git => "https://github.com/p7r/will_paginate.git", :branch => "rails3"

希望这能回答你的问题。