Learning Ruby and Ruby on Rails
I’ve been wanting to learn ruby and rails for a while now. But my previous efforts haven’t worked out well. These past few weeks I’ve committed to finally getting a reasonable grasp on this technology. I’ve used a few different resources and picked up a couple of tips en-route, which I share for you here.
Installing Everything
I’ve tried and failed to install Ruby and Rails before, on one occasion I completely frigged my LAMP stack. I run Ubuntu on my laptop and this is the guide that worked for me.
How to install Ruby on Rails in Ubuntu 11.10
Having installed everything, you might notice that the Ruby version swaps back to 1.8.7 with every new session. You can set the default version of Ruby by running this command.
$ rvm --default use 1.9.2
Starting With Ruby
Before starting with Rails, it’s well worth having a good grasp of Ruby. I found these two tutorials very helpful. The first is ideal if (like me) you’ve never written a line of ruby. The second is a tour-de-force around the language.
When working through the Koans, have an interactive ruby console open to try out things as you learn them. You can open a Ruby console like this:
$ irb
Starting With Ruby on Rails
Once you’re up-to-speed with Ruby, you can start dipping your toe in to Rails. I’ve not spent much time with Rails yet, but so-far, I’ve found these resources very useful.
This is a short exercise that takes you through the basics of Rails while building a simple blog platform.
You should definitely take the time to work your way through the Rails Tutorial. The course covers all areas of the framework (including versioning with Git, unit testing with RSpec and deploying to Heroku) on the way to building a Twitteresq micro-blogging app. The author suggests that no prior knowledge of ruby is needed, but personally I found it better to work through the Ruby Koans first to better separate the Ruby from the Rails in my mind.
Resources
A complete reference for the Rails API and the Ruby language.
If you’re coming to Ruby from PHP (as I am) this site is your bi-lingual dictionary.