gpt4 book ai didi

ruby-on-rails - Rails4 + 设计 + mongoid - `require' : cannot load such file -- mongoid/version (LoadError)

转载 作者:行者123 更新时间:2023-12-04 07:31:12 24 4
gpt4 key购买 nike

我正在尝试将 rails4 与 mongoid 和设计一起使用。我的 Gemfile 中有这个

gem 'rails', '4.0.0'
gem 'mongoid'
gem 'devise'
bundle install是成功的。但是当我尝试启动时 rails server ,我收到这个错误
Exiting
/home/username/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require': cannot load such file -- mongoid/version (LoadError)
from /home/username/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
from /home/username/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
from /home/username/.rvm/gems/ruby-2.0.0-p0/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
from /home/username/.rvm/gems/ruby-2.0.0-p0/gems/devise-3.0.0/lib/devise/rails.rb:34:in `block in <class:Engine>'
from /home/username/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `instance_exec'
from /home/username/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0/lib/rails/initializable.rb:30:in `run'
from /home/username/.rvm/gems/ruby-2.0.0-p0/gems/railties-4.0.0/lib/rails/initializable.rb:55:in `block in run_initializers'

我在 Ubuntu 上使用 Ruby 2.0.0

最佳答案

我遇到了同样的问题,只需在 Gemfile 中进行以下更改

gem 'mongoid', github: 'mongoid/mongoid'

如果设计继续出现问题,请更改设计
gem 'devise', github: 'plataformatec/devise', branch: 'rails4'

这解决了我的问题。

关于ruby-on-rails - Rails4 + 设计 + mongoid - `require' : cannot load such file -- mongoid/version (LoadError),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17770107/

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