How do I switch to older versions of the ruby/rails environment?

ε祈祈猫儿з 提交于 2019-12-02 19:37:31

Try,

rvm use <ruby version>
rvm gemset create rails2.3.2
rvm <ruby version>@rails2.3.2
gem install rails --version=2.3.2

Finally the syntax to create a new rails app in older versions of rails was just:

rails <appanme>

For more information about gemsets: RVM: Named Gem Sets

This will install Ruby 1.8.7 and then create a gemset that will contain only a specific set of gems:

rvm install 1.8.7
rvm --create use 1.8.7@old_rails
gem install rails --version=2.3.2

Whenever you want to use this after the first time just:

rvm use 1.8.7@old_rails

.rvmrc files are really useful for automatically managing different sets of Ruby versions and gems. If you create file called .rvmrc in the project directory and put this line in it:

rvm --create use 1.8.7@old_rails

Then every time you cd into that directory RVM will switch to Ruby 1.8.7 and the gemset "old_rails". Have a look at the docs for .rvmrc here: http://rvm.beginrescueend.com/workflow/rvmrc/

Of course you can change "1.8.7" for "1.8.6", "1.8.7-p249", "ree-1.8.7-2010.02" or any other Ruby version you like, I just assumed that you would want 1.8.7.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!