How do I upgrade to Rails 5?



How do I upgrade to Rails 5 in the Cloud 9 IDE?

I recently started learning on and when I started the tutorial used 4.2.2 but it was recently updated to 5.0.0. When I follow the tutorial and try to create a new app:
$ rails 5.0.0.rc2 new toy_app

Then I get this error message:
/usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:310:in to_specs': Could not find 'railties' (= 5.0.0.rc2) - did find: [railties-4.2.6,railties-4.2.4,railties-4.2.2,railties-4.2.0.beta2] (Gem::MissingSpecVersionError) Checked in 'GEM_PATH=/usr/local/rvm/gems/ruby-2.2.1:/usr/local/rvm/gems/ruby-2.2.1@global', executegem envfor more information from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:320:into_spec’
from /usr/local/rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_gem.rb:65:in gem' from /usr/local/rvm/gems/ruby-2.2.1/bin/rails:22:in'
from /usr/local/rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in eval' from /usr/local/rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in


This will install the most recent version of Rails:

$ gem install rails

I had the same problem as you before doing that, and after doing that just now, the command

$ rails _5.0.0_ new toy_app

worked just fine.


I’m using a new project & can’t get it to upgrade via “gem install rails” … suggestions?


What’s the problem? Does it throw any errors? Does it appear to upgrade but when running rails -v it shows the old version?


That’s the weird part - it runs, says success, but my rails -v still shows “4.2.5”

Update: Apparently it says success, but if the gemfile has the old entry in there - it will fail without explaining it - I found the issue by running bundle install. Then removed the 4.2.5 completely & left no specification - which recommended I bundle update instead.


Clean up if I forgot to post (incase I just can’t see it) - I had something sticking in the gemfile.lock

  1. Deleted gemfile.lock

  2. Gem install rails '5' // note you should probably put those fancy ‘~>’ signs infront of the version you want

  3. bundle install

  4. bundle update // might be redundant, but thorough


You could simply uninstall the current workspace’s Rails gem and install the new one again:

sudo gem uninstall rails

sudo gem install rails

Then create a new application:

rails new APP_NAME


I had thought about starting a new app, but was in way too many hours, but thanks @BigChief45