RubyGems is Ruby's package manager. You can install as many versions of gems (packages) as you want. You can install the latest by running sudo gem install rails
(at the moment it will install 2.3.5). If you need 2.2.2, specify that with the -v
or --version
option: sudo gem install rails --version 2.2.2
. Rails also installs a binary (yes, I know it's not really a binary file), rails
, which generates a project. Because you have several versions of the gem, you need to control which binary gets called. When you install the rails gem, RubyGems puts a file in it's bin/
dir, which is a "link" to the real rails
binary. That is the one you "call" when you say rails
on the command line. However, all of the rubygems "link" binaries accept a parameter of it's own, which is what version you want to use. You would use the 2.2.2 rails binary like this:
rails _2.2.2_ my_project
I think the default is to use the most recent version, so if you want to use the most recent version, do this:
rails myproject
However, I see that you use 2.2.2 to get access to the scaffold
method. I would strongly suggest you not to use that method, there's a reason for removing it. The scaffold
method hides code, and makes customization hard. Instead, use the scaffold generator:
./script/generate scaffold --help
Good luck on your future rails adventures!