如何在rails 4中使用mongo_mapper?

Ayd*_*kov 4 ruby-on-rails mongodb mongomapper

我试图使用rails 4.0.0与mongo_mapper 0.12.0并获取该消息

Bundler could not find compatible versions for gem "activesupport":
  In Gemfile:
    mongo_mapper (~> 0.12.0) ruby depends on
      activesupport (~> 3.0) ruby

    rails (= 4.0.0) ruby depends on
      activesupport (4.0.0)
Run Code Online (Sandbox Code Playgroud)

Rails 4和mongo_mapper仍然不兼容?

ror*_*rra 6

Mongomapper 0.12.0不适用于activesupport 4.0.0

你可以在文件mongo_mapper.gemspec上查看它:

s.add_dependency 'activemodel',   '~> 3.0'
Run Code Online (Sandbox Code Playgroud)

但是你可以使用版本0.13.0.beta2,如果你检查文件mongo_mapper.gemspec:

s.add_dependency 'activesupport', '>= 3.0'
Run Code Online (Sandbox Code Playgroud)

所以你需要在你的Gemfile中做

gem 'mongo_mapper', '>= 0.13.0.beta2'
Run Code Online (Sandbox Code Playgroud)