Rails4 +设计+ mongoid - `require':无法加载这样的文件 - mongoid / version(LoadError)

时间:2013-07-21 07:36:18

标签: ruby-on-rails ruby-on-rails-4

我正在尝试使用带有mongoid和devise的rails4。我在我的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

2 个答案:

答案 0 :(得分:6)

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

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

如果Devise继续出现问题,也可以改变设计

gem 'devise', github: 'plataformatec/devise', branch: 'rails4'

这解决了我的问题。

答案 1 :(得分:0)

运行

bundle update

如果这不起作用,请尝试包含轻便摩托车宝石

gem 'moped'