Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

ruby on rails - How do I "activate" a different version of a particular 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.

Is it possible to do this? I'm not using rvm. Maybe it's time to start.

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.

(I do already use bundler for my apps -- but haven't needed any precise control over gems at the OS level until now)

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

This pattern (gem-binary _gem-version_) works for any gem binary.

Hope it helps.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...