Change version of rails

2019-05-17 18:02发布

问题:

I accidentally changed my rails version to 4.0.0. I've tried gem uninstall rails --version=4.0.0.rc1 and install version 3.2.13 but when rails -v it's still version 4.0.0. I then tried gem uninstall rails, which gives me "Successfully uninstalled rails-3.2.13". Thought this was easy to do, but I can't find a simple solution.

回答1:

Try this:

rvm use <ruby version>

You can also check your installed ruby versions using rvm list and then switch over. Then do:

rvm gemset create rails3.2.13
rvm <ruby version>@rails3.2.13
gem install rails --version=3.2.13


回答2:

Remove your Gemfile.lock and install rails again. Make sure you specify the version of Rails.

source 'http://production.cf.rubygems.org'
ruby '1.9.3'

gem 'rails',           '3.2.13'