"development" 在我的 development.rb 中我添加了: config.-6ren">
gpt4 book ai didi

ruby-on-rails - Rails 4.1.2 无法安装 bullet gem

转载 作者:数据小太阳 更新时间:2023-10-29 08:37:47 24 4
gpt4 key购买 nike

我已经添加到我的 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)

在此先感谢您的帮助。

最佳答案

嗯..对我来说很好用。尝试了一个现有项目和一个新项目 - 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

关于ruby-on-rails - Rails 4.1.2 无法安装 bullet gem,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25315714/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com