2

我已添加到我的 Gemfile 项目符号 gem:

gem "bullet", :group => "development"

在我的 development.rb 中我添加了:

  config.after_initialize do
    Bullet.enable = true
    Bullet.alert = true
  end

当我尝试运行我的 rails 服务器时,我收到以下错误消息:

/home/mateusz/.rvm/gems/ruby-2.0.0-p0@rails4/gems/bullet-4.7.1/lib/bullet/active_record4.rb:53:in `alias_method': undefined method `construct_association' for class `ActiveRecord::Associations::JoinDependency' (NameError)

提前感谢您的帮助。

4

1 回答 1

4

嗯..我工作得很好。尝试了一个已有的项目和一个新项目——Win & Lin,两者都有。一定有其他问题,可能与gem版本或rails版本有关。

只是为了一个测试用例 - 你为什么不创建一个新的测试项目,看看它是否在那里工作

rails new testproj
cd testproj
rails generate scaffold Person name:string
rake db:create db:migrate

完成后,只需打开gemfile并添加:gem "bullet", :group => "development"
然后在testproj/config/environments/development.rb文件中,添加这个

Rails.application.configure do
  ...
  config.after_initialize do
    Bullet.enable = true
    Bullet.alert = true
  end
  ...
end

完成后,只需执行bundle install并开始rails server

如果仍然出现错误,请更新 gems:-
gem update --system然后gem update

于 2014-08-15T04:10:22.817 回答