如何“激活"?特定宝石的不同版本? [英] How do I "activate" a different version of a particular gem?
问题描述
我想在 rails 2.3.10 作为我操作系统的活动"gem 之间切换,以便我可以在命令行中调用它.
I want to switch between rails 2.3.10 as the "active" gem for my OS, so that I can invoke it at the command line.
可以这样做吗?我没有使用 rvm.也许是时候开始了.
Is it possible to do this? I'm not using rvm. Maybe it's time to start.
我尝试了 gem install rails --version=2.3.10
,但这只是确保安装了 gem 的版本,它没有放在 /usr/bin 中/rails
.
I tried gem install rails --version=2.3.10
, but that just makes sure that version of the gem is installed, it doesn't put it in /usr/bin/rails
.
(我已经在我的应用程序中使用了 bundler ——但直到现在还不需要在操作系统级别对 gem 进行任何精确控制)
(I do already use bundler for my apps -- but haven't needed any precise control over gems at the OS level until now)
推荐答案
如果你的问题是运行某个版本的二进制文件,那么:
If your problem is to run binaries of a certain version, then:
rails --version # => the latest version
rails _2.3.10_ --version # => Rails 2.3.10
此模式(gem-binary _gem-version_
)适用于任何 gem 二进制文件.
This pattern (gem-binary _gem-version_
) works for any gem binary.
希望对你有帮助.
这篇关于如何“激活"?特定宝石的不同版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!