开发者

rails new project_name using rvm

开发者 https://www.devze.com 2023-04-13 05:37 出处:网络
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 ver

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 v开发者_如何学Goersion 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?


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/


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号