开发者

How to use a gem temporarily?

I want to build an application usi开发者_如何学Cng Rails 3.0.1 but do not want to switch permanently from Rails 2.3.8 and thus require to use Rails 3.0.1 only for that specific application.

Is using bundles an answer, if yes than how??

Thanks in advance.


If you are using Mac or Linux, the most popular way is to use RVM. You can have multiple versions of Ruby and multiple gemsets.

The Agile Web Development book mentioned using

rails _2.3.8_ proj_name

and a rails 2.3.8 project is created and inside this project, it will use Rails 2.3.8


You can also create a git branch that's your rails 3 version

git branch rails3
git checkout rails3
-- Make it rails 3
git commit -am "Updated for rails 3!"
-- Go back to rails 2
git checkout master
-- make changes to your code
git checkout rails3
-- bring those changes into your rails3 branch
git merge rails3 master
git commit -am "merge from 2.3 master"


You can freeze rails gem by

rake rails:freeze:gems  # Lock this application to the current gems (by unpacking them into vendor/rails)
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜