17

I want to create a new rails app in 3.0.10 but the latest rails in my machine is 3.1.3. If I run:

gem list rails

Then I get the following output:

*** LOCAL GEMS ***

rails (3.1.3, 3.0.11, 3.0.10, 3.0.9, 3.0.7, 3.0.6, 3.0.4.rc1)
rails3-jquery-autocomplete (1.0.5)

Now I have applications in both 3.1 and 3.0 so I don't want to remove 3.1. How can I create this new rails app in 3.0.10?

ekremkaraca
  • 1,453
  • 2
  • 18
  • 37
Kashyap
  • 479
  • 5
  • 17

2 Answers2

29

To create a rails application for a specific version you can use this syntax: $rails _3.0.10_ new appname

NOTE: The underscores are needed.

Aldo 'xoen' Giambelluca
  • 12,075
  • 7
  • 33
  • 39
  • 1
    For a moment I thought the underscores were used as emphasis, but they're actually part of this undocumented syntax. – Lloeki Feb 12 '14 at 13:57
3

You should definitely use RVM (ruby version manager), to use different versions of rails can be reached easily:

rvm gemset create rails3
rvm gemset create rails3.2
rvm gemset create rails3.1

then, to you should use on of them to create rails project

rvm gemset use rails3 && gem install rails -v 3.0.10
rvm gemset use rails3.2 && gem install rails -v 3.2.2
rvm gemset use rails3.1 && gem install rails -v 3.1
Said Kaldybaev
  • 9,380
  • 8
  • 36
  • 53