问题
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.
回答1:
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.
回答2:
Try using rails4 branch to avoid upgrading issue.
gem 'globalize3', git: 'https://github.com/svenfuchs/globalize3.git', branch: 'rails4'
However, you may still meet some issues, because it's not stable branch.
来源:https://stackoverflow.com/questions/17750786/trouble-upgrading-ruby-on-rails-from-version-3-2-13-to-4-0-0