我已添加到我的Gemfile bullet 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)
提前感谢您的帮助。
答案 0 :(得分:4)
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
如果仍然出现错误,请更新宝石: -
gem update --system
然后gem update