将Ruby on Rails从3.2.13版升级到4.0.0时遇到问题 [英] Trouble upgrading Ruby on Rails from version 3.2.13 to 4.0.0

查看:155
本文介绍了将Ruby on Rails从3.2.13版升级到4.0.0时遇到问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于我的应用程序,我试图将Ruby on Rails从版本 3.2.13 升级到 4.0.0 在安装/更新某些gem(通过使用Bundler)时,特别是 globalize3 gem,我遇到了麻烦。我正在运行Ruby 2.0.0-p247



鉴于我的 Gemfile 是:

  gem'rails','4.0.0'

gem' globalize3',github:'svenfuchs / globalize3',分支:'rails4'

gem'delayed_job',:git => 'git://github.com/collectiveidea/delayed_job.git',:branch => 'master'
gem'delayed_job_active_record',:git => 'git://github.com/collectiveidea/delayed_job_active_record.git',:branch => 'master'

#添加这些gem来帮助转换到rails4:
gem'protected_attributes'
gem'rails-observers'
gem'actionpack-page_caching '
gem'actionpack-action_caching'
gem'activerecord-deprecated_finders'

当我在终端窗口中运行 bundle install 命令时,我得到以下输出:

 更新git://github.com/svenfuchs/globalize3.git 
从https://rubygems.org/中获取gem元数据.......
从https://rubygems.org/获取gem元数据..
解析依赖关系...
Bundler无法找到适用于gemactiverecord的兼容版本:
在Gemfile中:
globalize3(> = 0)ruby依赖于
activerecord(〜> 3.0)ruby

delayed_job_active_record(> = 0) on
activerecord(4.0.0)

Bundler找不到兼容版本的宝石rails:
在Gemfile中:
globalize3(> = 0)ruby依赖于
rails(〜> 3)ruby

rails(4.0.0)

当我运行

然后我得到以下输出:

 更新git://github.com/collectiveidea/delayed_job.git 
更新git://github.com/collectiveidea/delayed_job_active_record.git
更新git://github.com/svenfuchs/globalize3.git
从https://rubygems.org / .......
获取gem元数据从https:/ /rubygems.org/ ..
解决依赖关系...
Bundler找不到与gemrails兼容的版本:
在Gemfile中:
globalize3(> = 0) ruby依赖于
rails(〜> 3)ruby

rails(4.0.0)

Bundler找不到兼容版本的宝石railties:
在Gemfile中:
globalize3(> = 0)ruby取决于
railties(〜> 3.0)ruby

coffee-rails(〜> 4.0.0 )红宝石取决于
railt ies(4.0.0)

Bundler无法找到适用于gemactionpack的兼容版本:
在Gemfile中:
rails(= 4.0.0)ruby依赖于
actionpack(= 4.0.0)ruby

actionpack-action_caching(> = 0)ruby依赖于
actionpack(4.0.0.rc2)

我该如何解决问题?是否 globalize3 gem与Ruby on Rails 4真的兼容?是否建议等待升级到Ruby on Rails 4?



注意:我看到 railscast和我在互联网上进行了许多搜索(最合理的讨论是 Globalize3不支持Rails4 ),但我仍然遇到麻烦。

解决方案

globalize3 gem已被重命名为 globalize 和主版本号现在对应于相应版本的ActiveRecord(3.x for AR3而4.x代表AR4)。



所以你只需要把它放在你的Gemfile中,你就不会有任何冲突:

  gem'globalize','〜> 4.0.0.alpha.2'

另见 github存储库以获取更多详细信息。


For a my application I am trying to upgrade Ruby on Rails from version 3.2.13 to 4.0.0 and I am in trouble when installing / updating some gem (by using the Bundler), specifically the globalize3 gem. I am running Ruby 2.0.0-p247.

Given my Gemfile is:

gem 'rails', '4.0.0'

gem 'globalize3', github: 'svenfuchs/globalize3', branch: 'rails4'

gem 'delayed_job', :git => 'git://github.com/collectiveidea/delayed_job.git', :branch => 'master'
gem 'delayed_job_active_record', :git => 'git://github.com/collectiveidea/delayed_job_active_record.git', :branch => 'master'

# Added these gems to help with the transition to rails4:
gem 'protected_attributes'
gem 'rails-observers'
gem 'actionpack-page_caching'
gem 'actionpack-action_caching'
gem 'activerecord-deprecated_finders'

When I run the bundle install command in the Terminal window

Then I get the following output:

Updating git://github.com/svenfuchs/globalize3.git
Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "activerecord":
  In Gemfile:
    globalize3 (>= 0) ruby depends on
      activerecord (~> 3.0) ruby

    delayed_job_active_record (>= 0) ruby depends on
      activerecord (4.0.0)

Bundler could not find compatible versions for gem "rails":
  In Gemfile:
    globalize3 (>= 0) ruby depends on
      rails (~> 3) ruby

    rails (4.0.0)

When I run the bundle update command in the Terminal window

Then I get the following output:

Updating git://github.com/collectiveidea/delayed_job.git
Updating git://github.com/collectiveidea/delayed_job_active_record.git
Updating git://github.com/svenfuchs/globalize3.git
Fetching gem metadata from https://rubygems.org/.......
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Bundler could not find compatible versions for gem "rails":
  In Gemfile:
    globalize3 (>= 0) ruby depends on
      rails (~> 3) ruby

    rails (4.0.0)

Bundler could not find compatible versions for gem "railties":
  In Gemfile:
    globalize3 (>= 0) ruby depends on
      railties (~> 3.0) ruby

    coffee-rails (~> 4.0.0) ruby depends on
      railties (4.0.0)

Bundler could not find compatible versions for gem "actionpack":
  In Gemfile:
    rails (= 4.0.0) ruby depends on
      actionpack (= 4.0.0) ruby

    actionpack-action_caching (>= 0) ruby depends on
      actionpack (4.0.0.rc2)

How can I solve the problem? Is the globalize3 gem really compatible with Ruby on Rails 4? Is it advisable to wait for upgrading to Ruby on Rails 4?

Note: I seen the #415 Upgrading to Rails 4 railscast and I made many searches on the Internet (the most reasonable discussion is "Globalize3 does not work with Rails4") about the problem, but I am still in trouble.

解决方案

The globalize3 gem has been renamed globalize and major version numbers now correspond to the corresponding version of ActiveRecord (3.x for AR3 and 4.x for AR4).

So all you need to do is put this in your Gemfile, and you should not get any conflict:

gem 'globalize', '~> 4.0.0.alpha.2'

See also the github repository for more details.

这篇关于将Ruby on Rails从3.2.13版升级到4.0.0时遇到问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆