Conflict updating to Rails 3.1.10 - ruby-on-rails

I am currently running one of my Rails applications on version 3.1.3. My gemfile always listed:
gem 'rails', '3.1.3'
This worked just fine. In an effort to move to 3.1.10, I changed my Gemfile to the following:
gem 'rails', '~> 3.1.10'
Surprisingly, things break when I run bundle update rails after that change:
Bundler could not find compatible versions for gem "multi_json":
In Gemfile:
twitter (>= 0) ruby depends on
multi_json (~> 1.3) ruby
fnordmetric (>= 0) ruby depends on
multi_json (1.2.0)
Just as a test, I tried changing the gem version to '>= 3.1.0' and that installed without any quims, albeit it went to 3.2, which I'm not ready for just yet on this particular application.
Any suggestions for getting this thing running on 3.1.10 which was released today to address a security vulnerability?
Also an update:
I am having absolutely no trouble stashing Gemfile.lock away and starting from Rails 3.1.4. As soon as I try to go to 3.1.5+, this is where all the trouble begins.

Make the change in your Gemfile to
gem 'rails', '3.1.10'
Then try running
bundle update
instead of
bundle install
I can't see your Gemfile but this should will allow the bundler to try and find compatible Gem matches. If you have hard code a Gem revision you might have to relax it and repeat the update. Good luck!

Looking at the gems, it appears that oauth2 lists "multi_json ~> 1.0" and ActiveSupport 3.1.10 lists "multi_json < 1.3, >= 1.0" as the dependencies, so that should resolve. I've run into strangeness like this and fixed it by running
gem uninstall <relevant gems>
then running bundle install again. So maybe try
gem uninstall oauth2 multi_json activesupport
then bundle install
Edit
gem uninstall twitter multi_json fnordmetric

Related

Force Bundler to install gems supported by the local Ruby version

Is there a way of installing the latest supported version of a dependency without specifying it?
I'm having issues with the activesupport gem. The latest version (5.0.0.1) supports Ruby >= 2.2.2. If I'm specifying that I require the gem like this '~> 4.2' Bundler will try to install version 5 even if I'm on Ruby 2.0. Specifying the exact version 4.2.7.1 or setting a maximum '~> 4.2', '< 5' works, except when using the gem with Rails 5.
Is there a way to manage gem versions based on the current Ruby version?
Apparently the new version of Bundler will do this for you automatically.
I found this comment from André Arko that mentions this is already included in the latest RC version.
I specified Ruby '2.0' in my Gemfile, installed Bundler with gem install bundler --pre (it installed bundler-1.13.0.rc.2) and bundle install successfully installed activesupport 4.2.7.1.
With Bundler 1.12.5 I was getting the following error:
An error occurred while installing activesupport (5.0.0.1), and Bundler cannot continue.
Note that while a bit more manual, you can also include logic in your Gemfiles:
if RUBY_VERSION < "2.2.2"
gem "activesupport", "4.2.7.1"
else
gem "activesupport", "5.0.0.1"
end

ActiveAdmin with Rails 4: Bundler could not find compatible versions for gem "rails"

I am new to rails and building my first web application using version 4.2.4.
I am trying to install the activeadmin gem using
gem 'activeadmin', '~> 0.6.6'
However, when I run bundle install I get an error which says:
Bundler could not find compatible versions for gem "rails":
In snapshot (Gemfile.lock):
rails (= 4.2.4)
In Gemfile:
activeadmin (~> 0.6.6) ruby depends on
rails (< 4, >= 3.0.0) ruby
rails (= 4.2.4) ruby
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
Is this suggesting that I need to go down a version of rails in order to make this gem work or can I keep 4.2.4 and use the suggested bundle update method without causing any issues with my app and other gems?
The version of activeadmin that your Gemfile specifies does not support Rails 4. From the readme:
We're currently working on 1.0.0, which as far as dependencies, moves
us from meta_search to Ransack and adds Rails 4 & 5 support.
You can get it by tracking master:
gem 'activeadmin', github: 'activeadmin'
Or you can using rubygems:
gem 'activeadmin', '~> 1.0.0.pre2'
Change your Gemfile as shown, and then run bundle install

Bundler fails because it can't find compatible version of faraday gem

I'm trying to install a the instagram-ruby-gem but bundler keeps failing with this error:
Bundler could not find compatible versions for gem "faraday":
In Gemfile:
instagram (>= 0) ruby depends on
faraday (< 0.9, >= 0.7.4) ruby
instagram (>= 0) ruby depends on
faraday (0.9.0)
Here's my Gemfile:
gem 'instagram', git: 'https://github.com/larrylv/instagram-ruby-gem.git'
I am using this specific fork because it fixes the faraday version to be compatible with Rails 4. See the commit here, but here's the change:
- s.add_runtime_dependency('faraday', ['>= 0.7', '< 0.9'])
+ s.add_runtime_dependency('faraday', '>= 0.7.4', '<= 0.9.0')
I already tried bundle update. That did not work. The only faraday version installed is faraday 0.9.0.
I downloaded the forked gem, built it and then installed it. It looks like it went through without any issues on my end. So it is something to do with the environment or a gem conflict issue. I'd check to make sure you don't have any other versions of the gem installed. Do you use RVM by any chance and use gemsets with RVM? As a last resort you could delete the Gemfile.lock, but that is not really recommended. You could look at the Gemfile.lock file as well and look at the faraday references. Perhaps other gems need a certain version and the forked gem you use requires another version? I have run in to that before. It is not fun to try and resolve.
Mike Riley

Is it necessary to update the line of gem in Gemfile when using bundle update gem-name?

I want to update my jquery_rails gem, actual version is 3.0.4, the following command will update it
bundle update jquery_rails
so, what about my Gemfile, it is necessary to update version of jquery_rails too ? ("i work currently in local")
in my Gemfile i have version 2.2.1
gem 'jquery-rails', '2.2.1'
Update
i change gem 'jquery-rails', '2.2.1' in my Gemfile to gem 'jquery-rails', '3.0.4', and i tried to execute bundle update jquery-railsbut an error is occur :
Bundler could not find compatible versions for gem "railties":
In Gemfile:
rails (= 4.0.0) ruby depends on
railties (= 4.0.0) ruby
sass-rails (= 4.0.0) ruby depends on
railties (4.0.1)
Firstly, you should update your gem file and specify required version of the gem, then run bundle update jquery_rails.
Error tells you, that you have gems which required different version of railties. Try to change versions of rails to 4.0.1, sass-rails to 4.0.1 and railties to 4.0.1 and update these gems via bundle.
To answer your question directly, in this case yes it is necessary to update the version in Gemfile, but it is not always.
Running bundle update <gem> will cause Bundler to find the most recent version of the gem and its dependencies that satisfies all of the requirements of the Gemfile. Since you have specified a requirement of a specific version, Bundler will only allow that version. You can also specify a more flexible version in your Gemfile: gem 'jquery-rails', '~> 2.2.0' would allow it to use any 2.2.x version, or '~> 2.2' would allow any 2.x.
The issue with sass-rails is separate. You can solve it by updating to sass-rails 4.0.1. See can't get gemfile to allow for bundle update

Rails_admin gemfile, bundle install, rails version question

While trying to install Rails admin, I added it to my gem file as instructed. I deleted the gemfile.lock
Then I ran bundle install. I got this message:
Bundler could not find compatible versions for gem "rails":
In Gemfile:
rails_admin depends on
rails (~> 3.0.3)
rails (3.0.1)
I am using rails 3.0.1, not really sure I understand the issue? But its obviously stopping me from installing.
Also, if I put rails_admin in the gem file like so:
gem 'rails_admin'
instead of:
gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
that seems to install it a version 0.0.0 and then doesn't proceed to do anything (so clearly thats not right either).
Is there a version I can specify that might work?
Thanks!
The issue is that the gem now required rails 3.0.3 and you are using 3.0.1
~> means at least this tiny revision or greater.
E.G. ~> 3.0.3 means 3.0.x where x >= 3
As for what gem version will work on 3.0.1 I do not know.

Resources