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)
Use `gem install -v` You may already be familiar with gem install , but if you add the -v flag, you can specify the version of the gem to install. Using -v you can specify an exact version or use version comparators.
To automate the process of switching gems, pop . ruby-version and . ruby-gemset files in your project root. Pop the version of Ruby and name of the gemset you want to use inside them and RVM wil select the correct gemset when you cd into your project directory.
The newer versions of rake can be activated by supplying an optional first argument, that is the gem version. Alternatively, if you have an older version of rake you can update the rake script manually to include this parameter (or specify any specific version you want).
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With