This is the tutorial that explains you how to use different Rails and Ruby versions on your machines.
It assumes you're using Ruby Version Manager.
rails _<VESRION>_ new test_app
E.G.
rails _3.1.6_ new test_app
If you don't have that specific version installed, you will get an error. You can get a list of a rails versions with:
gem list rails
To install the missing Rails version use
gem install rails -v <VERSION>
NOTE: Rails 2 apps use rails test_app
to create new app.
NOTE: Change directory to /tmp/
to create Rails apps inside your tmp directory (everything gets removed on shutdown). NO CLUTTER!
Rails versions depend on your currently used Ruby version. You can convince yourself this is true by checking out the RVM gems directory:
ls ~/.rmv/gems
There you'll see folders named like this:
RUBY_VERSION@GEMSET
Therefore, you are installing gems for the specific Ruby version you're using. This is also true for gemsets.
You can list the gems that are being currently used by your Rails app with
bundle list
To show where the specific gem is installed use
bundle show <GEM_NAME>
You can cd into the listed directory and browse that gem's source.
Check out the cool flags you can use with
rails -h
One of them is --skip-bundle. Use it when you don't want to run bundle install
when generating the app directory. Let's assume you will be adding Airbrake or Exceptional to the Gemfile, so this will save you from running bundle install two times.