RVM question

I have a bit of a chicken & egg problem:

Assume I have a top level directory for all my Rails projects. Each project might be using a different version of Ruby and Rails.

How do I run a “rails new foo” with the correct ruby version and gemset?

Is there some sort of cmd line argument I can use?

-joe

rvm use version@gemset

You could also create a custom .rvmrc file for each project folder, in which you could specify the ruby version and gemset to use (or create if doesn’t exist’).

How do I run a "rails new foo" with the correct ruby version and gemset?

Is there some sort of cmd line argument I can use?

rails _4.1.10_ new

Should invoke that version of the rails executable (this is a rubygems thing - it should work with any executable provided by a gem.

Fred

I always begin new rails projects by first creating the project directory

$ mkdir foo

$ cd foo/

$foo/

Once in the directory I make a .ruby-version and .ruby-gemset file

$foo/ touch .ruby-version .ruby-gemset

In the ruby-version file you just specify the version of ruby you wish to use

2.2.1

and the ruby-gemset file you name the gemset you’d like to use

fooapp

Once you have those saved you can reload the current directory by

$foo/ cd .

Then just rails new . and then bundle install