5

I am trying to use rails4 with mongoid and devise. I have this in my Gemfile

gem 'rails', '4.0.0'
gem 'mongoid'
gem 'devise'

bundle install is successfull. But when i try to start rails server, I get this error

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'

I am using Ruby 2.0.0 on Ubuntu

Santhosh
  • 28,097
  • 9
  • 82
  • 87

2 Answers2

6

I was having same problem, just make following change in Gemfile

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

If Devise continues problem, change devise also

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

This solved my problem.

Pramod Shinde
  • 1,802
  • 1
  • 15
  • 28
0

Run

bundle update

If this didn't work, try including the moped gem

gem 'moped'
Mini John
  • 7,855
  • 9
  • 59
  • 108