开发者

How to have RAILS 2.3.5 and 3.0.4beta installed at the same time

I'm working on two different rails installations for two different projects. They are on different versions of rails. Here's what I have installed:

gem list --local开发者_StackOverflow中文版 | grep rails

shows that I have this installed:

rails (3.0.0.beta4, 2.3.5)

When I run a command to do a deployment for the app that uses 2.3.5, I get the following error:

Missing the Rails 2.3.5 gem. Please `gem install -v=2.3.5 rails`, update your 
RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do 
have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.

It's not finding the correct rails version, even though I have it installed. What are good short- and longer-term solutions for this problem?


I suggest you RVM. It allow you to have different ruby/gems versions on the same machine.


The long term solution is to look into rvm, especially the gemset feature makes it really easy to keep separate versions of gems and even ruby versions for different projects.

A short trem solution may be to add the the following line to your boot.rb file, somewhere before rails is required:

gem rails, "2.3.5"

This loads the right version of the gem, otherwise gem will think you want the latest version.


As others have noted, rvm is one way to solve this problem. The other is to use bundler, which involves some setup in your application and potentially requiring you to use 'bundle exec command' everywhere you want to run conflicting versions of a command (eg cucumber)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜