Search code examples
ruby-on-railsrubygemfile

What is keeping this rails project at an old rails version (or how can I find out what is keeping it at an old rails version)?


What is keeping this rails project at an old rails version (or how can I find out what is keeping it at an old rails version)?

I am looking at

https://github.com/mhartl/action_cable_chat_app

I cloned it, or forked and cloned it.

Granted, he has this in his Gemfile

gem 'rails',                   '5.0.1'

But I changed it to

gem 'rails'

and I did bundle install or bundle update or bundle update rails

and it went from the very old version(5.0.1), to rails 5.0.7.2 which is still old.

If I cd .. then I see my global rails version, that's a recent version. rails 5.2.3

I can guess that maybe there is some gems in his Gemfile that require an early rails version and that is what is holding it back. But I can't verify that and if it were I don't know which.

I tried looking at Gemfile.lock and it says rails (5.0.7.2) So I tried rm Gemfile.lock then bundle update rails, and still, rails 5.0.7.2


Solution

  • Have a look at the project's Gemfile.lock at line 78:

    jbuilder (2.4.1)
      activesupport (>= 3.0.0, < 5.1)
      multi_json (~> 1.2)
    

    The 2.4.1 version of the jbuilder gem is depending on an activesupport (which is part of Rails) version < 5.1. You would need to update at least to jbuilder:2.6.3 to allow updating Rails to 5.1. jbuilder:2.6.4 finally relaxes the dependency to just activesupport >= 3.0.0 which would even allow current Rails 6.0beta versions.

    Added by barlop

    answerer mentions in comment, see https://rubygems.org/gems/rails for dependencies of a gem

    (and it includes versions, so, what versions of rails are dependent on what version of dependent gem)