首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >rails 5.0.0.2不兼容和与gem mongoid的冲突

rails 5.0.0.2不兼容和与gem mongoid的冲突
EN

Stack Overflow用户
提问于 2016-02-22 14:31:32
回答 3查看 3.9K关注 0票数 10

ruby版本2.3.0

rails版本5.0.0.beta2

**GEMFILE **

代码语言:javascript
运行
复制
    source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '>= 5.0.0.beta2', '< 5.1'
#mongoid gem
gem 'mongoid', '~> 5.1.0'
# Use Puma as the app server
gem 'puma'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# Action Cable dependencies for the Redis adapter
gem 'redis', '~> 3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
end
group :development do
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console', '~> 3.0'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

在运行bundle安装之后,我看到:

代码语言:javascript
运行
复制
Bundler could not find compatible versions for gem "activemodel":
  In snapshot (Gemfile.lock):
    activemodel (= 5.0.0.beta2)

  In Gemfile:
rails (< 5.1, >= 5.0.0.beta2) was resolved to 5.0.0.beta2, which
depends on
activerecord (= 5.0.0.beta2) was resolved to 5.0.0.beta2, which
depends on
        activemodel (= 5.0.0.beta2)

rails (< 5.1, >= 5.0.0.beta2) was resolved to 5.0.0.beta2, which
depends on
activerecord (= 5.0.0.beta2) was resolved to 5.0.0.beta2, which
depends on
        activemodel (= 5.0.0.beta2)

    mongoid (~> 4.0.0) was resolved to 4.0.0, which depends on
      activemodel (~> 4.0)

    web-console (~> 3.0) was resolved to 3.1.1, which depends on
      activemodel (>= 4.2)

运行bundle update将从头开始重建快照,只使用Gemfile中的gems,这可能解决冲突。

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2016-04-30 20:10:06

几天前,您只需将以下内容添加到您的宝石文件中:

gem 'mongoid', git: 'https://github.com/mongodb/mongoid.git'

票数 20
EN

Stack Overflow用户

发布于 2017-04-06 19:18:07

我也遇到过同样的问题。我将mongoid版本更改为6.1.0,在运行包更新之后,一切都正常。

代码语言:javascript
运行
复制
#mongoid gem
gem 'mongoid', '~> 6.1.0'
票数 4
EN

Stack Overflow用户

发布于 2016-04-10 22:22:32

Rails 5上有一个5的特性分支,将其添加到您的Add文件中。

代码语言:javascript
运行
复制
gem 'mongoid', git: 'https://github.com/estolfo/mongoid.git', branch: 'MONGOID-4218-rails-5'
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/35556239

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档