5

Trying to install mongoid 3.1.6 in rails 4.1

Bundler could not find compatible versions for gem "activemodel": In Gemfile:

mongoid (~> 3.1.6) ruby depends on
  activemodel (~> 3.2) ruby

rails (= 4.1.0) ruby depends on
  activerecord (= 4.1.0) ruby depends on
    activemodel (4.1.0)

It works fine when mongoid is downgraded to 1.0.6 but i need to use mongoid 3.1.6 in rails 4.1. Is there any solution to solve this problemt?

Mothirajha
  • 1,033
  • 1
  • 10
  • 18

1 Answers1

10

You'll need to use a 4.x version of mongoid, which uses activemodel >= 4.0.0. Here's the latest:

gem 'mongoid', '~> 4.0.0'
Tom Hert
  • 947
  • 2
  • 10
  • 32
steakchaser
  • 5,198
  • 1
  • 26
  • 34
  • It works fine thank you, but now i have this error while starting rails server uninitialized constant Sprockets::Rails::VERSION (NameError) – Mothirajha Apr 11 '14 at 19:24
  • Are you upgrading an existing app from Rails 3.2.x to 4? Or, starting from scratch? I think this is another gem dependency issue somewhere. – steakchaser Apr 11 '14 at 19:29
  • starting a new application from scratch, using ruby 2.1.1, rails 4.1 – Mothirajha Apr 11 '14 at 19:31
  • Small update on this - authors already released version 4.0.0 of Mongoid gem, for more details see https://rubygems.org/gems/mongoid – Tom Hert Jul 10 '14 at 05:56