How can I access rails 2.3.x commands when rails 3 is installed?
I'd like to play around with rails 3, but I'm still used to rails 2.3.8 so I have them both installed. Wanting to make a quick rails app to demonstrate how a plugin works, I want to run the command rails test_app
but since I have rails 3 installed, I have to run rails new test_app
but that will generate a rails 3 app. Is there a way around开发者_如何学Go this while having rails 3 installed?
This is a perfect example of what rvm
's gemsets can do for you.
In a nutshell (after installing rvm):
% rvm gemset create rails2
% rvm gemset use rails2
% gem install rails -v=2.3.8
Now your current rails
is Rails 2!
Whenever you wish to use Rails 2 instead of Rails 3, do:
% rvm gemset use rails2
This will remain in effect for the current terminal/shell session. You can also switch back:
% rvm default
Of course you can also do the exact opposite and create a rails3
gemset to play around with Rails 3, and leave Rails 2 installed as the default.
(Apart from having gemsets, rvm
lets you install multiple versions of Ruby on the same system, allowing you to switch between different versions with a simple rvm 1.9.2
or rvm 1.8.7
.)
I think what you are looking for is:
rails _2.1.0_ projectname
Inside that project all the old script/server, script/generate stuff is there for you.
use rvm http://rvm.io/
you can use different/multiple ruby version and have different gemsets for each :) enjoy!
精彩评论