无法将Ruby on Rails从版本3.2.13升级到4.0.0

时间:2013-07-19 16:13:02

标签: ruby-on-rails gem ruby-on-rails-4 upgrade globalize3

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

鉴于我的Gemfile是:

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'

当我在终端窗口中运行bundle install命令时

然后我得到以下输出:

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)

当我在终端窗口中运行bundle update命令时

然后我得到以下输出:

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)

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

注意:我看到了globalize3 railscast,我在互联网上进行了很多搜索(最合理的讨论是“#415 Upgrading to Rails 4”)关于这个问题,但我是还有麻烦。

2 个答案:

答案 0 :(得分:0)

尝试使用rails4分支以避免升级问题。

gem 'globalize3', git: 'https://github.com/svenfuchs/globalize3.git', branch: 'rails4'

但是,您可能仍会遇到一些问题,因为它不是稳定的分支。

答案 1 :(得分:0)

globalize3 gem已重命名为globalize,主要版本号现在对应于ActiveRecord的相应版本(AR3为3.x,AR4为4.x)。

所以你需要做的就是把它放在你的Gemfile中,你不应该有任何冲突:

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

有关详细信息,另请参阅github repository