3

对于我的应用程序,我正在尝试将 Ruby on Rails 从版本升级3.2.134.0.0并且在安装/更新某些 gem(通过使用 Bundler)时遇到麻烦,特别是globalize3 gem。我正在运行 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)

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

注意:我看到了#415 Upgrading to Rails 4 railscast 并且我在互联网上进行了很多搜索(最合理的讨论是“ Globalize3 does not work with Rails4 ”),但我仍然遇到了麻烦。

4

2 回答 2

0

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

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

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

于 2013-07-21T13:01:21.263 回答
0

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

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

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

另请参阅github 存储库以获取更多详细信息。

于 2013-11-12T05:19:39.097 回答