Brand
Brand

Reputation: 1701

rails new project_name using rvm

I use rvm in my rails project and specify gem versions in the Gemfile.

However, my problem right now is different. I want to create a rails 3.1 project using rails new project_name but my current version of rails is Rails 3.0.3

I know I can just update my rails gem version but then will all future executions of rails new project_name create a 3.1 project?

How can I set things up so I can sometimes create rails 3.1 projects while other times creating rails 3.0 projects?

Upvotes: 1

Views: 1221

Answers (2)

Manish Shrivastava
Manish Shrivastava

Reputation: 32040

If RVM is already installed.and ruby is also installed for required version.

You just have to run the fallowing command:

> rvm use 1.9.3

1.9.3 is ruby version I wish to use. Then ,

> rails new projectname

That's it! Now, If you want to change rails verion of the project, Open folder of /Gemfile and change line below to any sepcified version .

 gem 'rails', '3.1.2'

Like if you want to use rails verison 3.0.5 then change '3.1.2' from line above to '3.0.5' and then run

 >`bundle install`

from command prompt. It worked fine for me! Hope you also can also do this way!

Cheers!

Upvotes: 2

bricker
bricker

Reputation: 8941

rvm 1.9.2
rvm gemset create rails310 rails303
rvm 1.9.2@rails310
gem install rails -v 3.1.0
rails new my_310_app

rvm 1.9.2@rails303
gem install rails -v 3.0.3
rails new my_303_app

http://beginrescueend.com/gemsets/basics/

Upvotes: 5

Related Questions