I’ve decided to take the plunge into the world of Ruby. Because I’ve dabbled before I have some some other project on my Ubuntu machine that depended on a little Ruby. To get up and running I’m using the highly recommended book Agile Web Development with Rails (Pragmatic Programmers). The only problem is I am using the Third Edition
where all the examples use Ruby 1.8.7 and Rails 2.2.2
One of the biggest gripes I had years ago when I was first presented with Ruby project to tweak was its complete lack of backward compatibility. A little utility call Ruby Version Manager (RVM) helps ease the pain. Here’s how to get it up and running on Ubuntu. The process should be similar on any *nix or mac OS
\curl -L https://get.rvm.io | bash -s stable
Install your ruby version
rvm install 1.9.2
see which version currently in use
Lets create a project with an older version of ruby to match the book’s tutorials
rvm install 1.8.7
Lets create a demo project with an older version of rails
rvm use --create [email protected]_project gem install rails -v 2.2.2
Now lets generate the project with rails
cd into the project directory and create a .rvmrc file so rvm will always know what versions to use for this project
rvm --rvmrc [email protected]_project
And there you have it.
Please note that I’m very new to this and there may be a better process. Feel free to let me know if there is. I’m simply documenting my first time process. I may change this document as I get more familiar to ruby and rvm over time.