Best way to learn Ruby & Rails

That’s no typo, I really did mean Ruby and Rails – but before you run off (those looking to learn only Rails) read on… I started off wanting to learn just Rails too, but I quickly realised two things:

  • Rails will only get you so far – to be anything close to a Rails ninja, you need to learn Ruby (Rails is Ruby underneath it all). While Rails goes out of its way to simplify a lot, once you begin to do more complex stuff you’re going to need to know Ruby – and because Ruby is so easy to pick up anyway it makes sense to learn it from the outset. It will not only save you time in the long run, but will also help you learn Rails as well, because you’ll have a better understanding of what’s going on.
  • Even if you came for Rails, most likely you will stay for Ruby – like so many of us! The more you’re exposed to Ruby the more you’ll want to learn it. Ruby is an awesome all-purpose language with a multitude of uses (it’s not just for web apps!) so is well worth adding to your repertoire. Trust me, it will quickly become your favourite language, but if you still need convincing, check out this post.

If you’re only interested in learning Ruby, just skip over the Rails bits. Ok let’s get started!

Is there really a best way to learn Ruby & Rails?

Of course – whatever works best for you. But if you don’t have a crystal ball, and if you’re anything like me where you’d just like someone to come out and say, “Look, do this, this and this – then this, this and this, and you’ll be well on your way!” then you’ve come to the right place.

Ideally you’ll want to do everything mentioned here, but if you’re on a tight budget I’ve rated things as either essential, highly recommended, or optional. A lot of the material listed here is either in beta or hot off the press – so you’ll be cutting edge too!

Update: Wondering whether this is a good guide to follow? The powers that be in the official Rails IRC chat room seem to think so – a link to this page is now returned with the “!learn” factoid/helpa bot in the #rubyonrails channel!

Look no affiliate links

I don’t want anyone to think I am recommending material because I am getting commission (despite some of the affiliate schemes offering 50%!) so rest assured I have read/watched everything I am recommending and I am in no way getting paid for it.

Is this list still current in 2015?

I reckon it is – just get the latest versions of the books or resources mentioned, most of them will have been updated. You don’t need to worry too much about the Ruby books though, they will still be very relevant.

Step 1 – Get excited!

This is probably where you are right now. You’ve read about the wonders of Rails and the beauty of Ruby, and you’ve made a decision to jump in. Great – you’ve made an excellent choice!

If you haven’t got yourself excited yet, read some of my previous articles on Ruby and Rails, then check out the blog in 20 minutes video just to whet your appetite and to give you an idea of what’s possible with Rails.

Then go ahead and do some (or all) of these:

TryRuby.org – a great way to learn the basics of Ruby via the browser.
RubyMonk.com – another nifty ‘do it in the browser’ tutorial!
RubyKickstart.com – just discovered this, haven’t done it myself but it looks good.

I assume you already have some basic knowledge of HTML and CSS, if not do a quick google – you just need the basics and neither are difficult to pick up.

On a tight budget?

Get digital versions whenever you can (especially if you’ve got a Kindle!) often publishers offer up to 40% (sometimes 50%) off! If you can’t find any discount codes, be cheeky, email (or tweet) the publishers asking if they have any (or if any are due soon) you might get lucky!

Step 2 – For beginners!

If you are new to programming, or OOP (object orientated programming) then we’re going to start with the wonderful Learn To Program by Chris Pine. You can read it FREE online, or you can buy a book (that includes answers) from pragprog.com

Learn To Program is a lovely introduction to programming (and OOP) and luckily for us, just so happens to be in Ruby! It also makes you realise you don’t have to be Einstein to be a programmer – I really like how Chris makes the reader feel like anyone can learn, not just the super smart or the super geeky.

This book is essential if you’re new to either programming or OOP, but highly recommended for any relative newcomer – read it just as a motivator if nothing else. It’s short and sweet, and helps you lose the “I don’t think I’ve got a programmer’s brain” mindset as well.

Step 3 – Essential Ruby Training

This one’s a breeze, because it’s visual – just sit back, relax and soak it all up.

Kevin Skogland’s Essential Ruby Training over at Lynda.com is a great addition to this guide. The screencasts are some of the most professional I have seen (and contain almost 7 hours of content!) and Kevin really knows his stuff, and knows how to get you to know it!

As the next step is also from Lynda.com you could easily take out a single month’s subscription and get both done for around $25!! (£15!) What a bargain! But it’s not just the price that earns this an essential – the videos are extremely well produced with good, relevant content …and at the perfect learning curve.

Step 4 – Ruby on Rails 3 Essential Training

Everything I’ve said above applies here. One of the reasons I like this course is because there’s no mention of TDD (test driven development)! As great as TDD is, for a n00b it over complicates things a bit too much, hence this course is very well balanced and great for people just starting out with Rails.

It’s 12 hours long – but in perfect 5 to 10 minute clips. Another well earned essential!

As with step 3, there’s no need to go through the demo app or exercises yourself. That’s the beauty of screencasts, you don’t really need to as you get to see everything on screen (plus, you’ll be getting your hands dirty later!) You can get it here

Ruby Ruby Ruby Ruby Ruby

We’ll be concentrating on Ruby for a while now. The Rails course above was to give you a taster and for you to be mindful of the basics of Rails while learning Ruby. We’ll come back to Rails later, by which time you’ll be pretty well versed in Ruby 🙂 (Btw, if you haven’t heard it.. Ruby Ruby Ruby Ruby Ruby. )

Step 5 – The Well Grounded Rubyist

I was totally hooked on this book when I first picked it up, it just made so much sense. I was also extremely impressed (and grateful!) with how David A Black explains every bit of code he includes – that’s such a big deal because it stops you from losing morale or feeling stupid. David is a real life teacher (it shows!) and the little touches and thoughtfulness in this book make it shine.

If you really didn’t want to do the three previous (Ruby) steps, you could quite easily jump right in here as this book covers the basics well – but try not skipping any steps if at all possible! This book’s not just about the basics either – it covers a great deal, spread over 15 well paced (and highly enjoyable) chapters.

No surprise this is an essential purchase. Get it here

Don’t be afraid to re-read chapters

Just want to quickly mention that as things are getting a bit hotter now, don’t be afraid to re-read chapters if things don’t quite sink in first time round. In the book above for example, I re-read the chapters on enumerators and enumerables.

Step 6 – Design Patterns in Ruby

Don’t be fooled by the age of this book – it’s still very relevant today, and absolutely without doubt, one of my all time favourites!

It’s all well and good knowing the fundamentals of a language (which you just learned from The Well Grounded Rubyist) but like any tool, it’s what you do with it that counts – and that’s where this book excels. It shows you how you might use Ruby in different situations.

Russ Olsen is clearly an eloquent writer, with a wealth of knowledge that he happily imparts in this easy to digest, amicably toned book. Another essential purchase. You can get it from here

Step 7 – Eloquent Ruby

Remember I said Russ Olsen was an eloquent writer? Fitting then, that he’s written Eloquent Ruby too!

When I read this book I highlighted so much of it on my Kindle that in the end, I thought forget that, I might as well read the book again later! There’s just so much in this book that you’ll find useful, interesting and noteworthy.

Eloquent Ruby teaches you how to use Ruby, well. Good clean idiomatic Ruby that you can be proud of. Apart from being a gifted writer, Russ is also an all round nice guy – and that warmth and friendliness shines through in his books – making them a very enjoyable read. You can get it from here another essential purchase.

Step 8 – Test your knowledge with Ruby Koans

It’s time to put your new found knowledge to the test! Simply head on over to Ruby Koans and answer the questions. The Koans promise to walk you along the path to enlightenment, and although they set out to teach you the Ruby language, syntax, structure, and some common functions and libraries, I think it’s an excellent refresher/quiz. Perfect to test what you’ve learnt up to here.

If you get stuck, check out my post that helps you with the answers: Ruby Koans Answers although you don’t need much help really, apart from knowing that there aren’t any trick questions it really is as simple as it sounds.

Back to Rails

As you’re now a Rubyist 😉 it’s time to get back to Rails. There’s a little more Ruby a little later tho (The RSpec Book) so skip on ahead if you’re only interested in the Ruby side of things. Otherwise get in gear because we’ve got some really cool stuff coming up.

Step 9 – Rails for Zombies

You’re going to love this! Rails for Zombies blew our minds when it first came out – cos it’s slick, gory and awesome all at the same time!

Not only do you get to watch some slick videos, but you actually get to try out what you’ve learned by answering questions after each segment – via the brain browser. Getting an answer wrong gives you instant feedback, and you can only proceed to the next level when you’ve answered all the questions correctly. So the Zombies force you to learn :p (Don’t worry, you can ask them for hints if you get stuck.)

It’s a super way to learn, and did I mention it’s FREE! There’s no way on earth this wasn’t going to be an essential! Get over to railsforzombies.org now (well not now, when you’re at step 9!) and make sure you do each level a number of times – up to the point where you don’t need to look at the slides (or videos) to answer the questions. That’ll really help drum it into your brain.

Step 10 – The Rails Tutorial

This Rails Tutorial is a great walk-through, where you get to create a Twitter-like app. You als get to use RSpec and a few other handy gems along the way as well – which makes this tutorial well worth doing, even if just to get another person’s perspective on how they might go about developing with Rails, especially as it’s free!

The book therefore, is essential (It’s free!) and the screencast is highly recommended, as you can just sit through it and not have to bother doing the actual tutorial yourself (if you don’t want to). There’s also some extra tid bits of info with the screencast, and Michael adds a bit of humour along the way too. Get the info here: railstutorial.org

Step 11 – Agile Web Development with Rails

This is the ‘official’ Rails book, being co-authored and endorsed by the creator of Rails himself, DHH. Needless to say it covers the default Rails stack, so if you’re _not_ interested in RSpec (or Cucumber) then this book will be of great interest to you. The ‘Getting Started with Rails’ chapter of the official Rails Guides are a perfect compliment to this book as it doesn’t cover the absolute basics itself – so this mini review assumes you have read that chapter first.

The book is well written and the tutorial is especially helpful if you’re interested in creating a shopping cart system. My favourite part of the book though, was part 3 – getting into the nitty gritty! I’m also very impressed with how Sam keeps this book updated for all major versions of Rails – it has just been updated to cover Rails 3.2 (and if you bought the eBook you get free updates!!) It’s a great book, but for this reason alone the book gets an essential rating – there aren’t many books that get updated as often as this one! You can buy it from here.

Step 12 – Rails Best Practices

I really, really, enjoyed this course. I’d already read a few books and gone through various Rails tutorials, yet it still managed to teach me a thing or two! I especially like some of the pro tips that the Code School team have included – and in a fun, engaging format too. Rails Best Practices is, imo, essential, although if you’re on a tight budget then it becomes a highly recommended as one might argue it’s more expensive (and contains less content) than a book.

To get the most out of it, be sure to do the course over and over again, to the point where you don’t need to refer to the slides to answer the questions – Code School really is a great way to learn and this has definitely been my favourite Code School course to date. You can check it out here.

Step 13 – The RSpec Book

I bought this book to help me conquer my fear. I imagine most people new to programming dread hearing the letters TDD and BDD – because we’re far more interested in learning how to get things done, not learn how to test the stuff we’re doing on trying to get things done! So I thought, well I’m gonna have to jump in bed with this TDD devil to stop being so god damn scared every time it’s mentioned. So I did, and you should too.

This is a great book, not only teaching you RSpec (and Cucumber) but because it also contains plenty of tips on good coding practices, as well as of course the fundamentals of TDD and BDD. After this book testing makes heaps more sense – and so for those of you interested in using RSpec in your apps, this book is without doubt an essential purchase – for everyone else, it is highly recommended. Get it from here.

Step 14 – Rails 3 in Action

This book is a really good walk through of Rails, where you get to see how a world class developer would go about creating a Rails app. This means it has the added bonus of covering tools such as RSpec and Cucumber, as well as other important and widely used gems.

I also like Ryan’s writing style, he talks you through what’s going on, making it easy for you to picture things in your head – so you don’t feel lost or stupid. Ryan’s actually a big fan of The Well Grounded Rubyist (it was Ryan who actually recommended it to me) and it’s clear he’s taken inspiration from that book… which is great news for us! He’s also a really cool guy who spends a lot of time answering questions in the Rails chat room – something I think has helped him see things from his readers point of view too, it’s almost as if he’s written the book we would have asked for (what more could we possibly want!?) You can get it from here – an essential purchase because of the aforementioned reasons, and that it covers so much, even things like APIs and Engines.

Step 15 – Go create!

By now you have a very good grounding in Ruby, and an excellent understanding of how you might use Rails – the only thing left to do is go create, and to go create some more. The more you get out there and do it the quicker it will all become second nature. Don’t worry if you don’t remember everything you have read (none of us are that super-human!) the aim is to get a good overview of everything – just go out there and make things, while referring to the following:

The brilliant RailsCasts is almost as old as Rails itself, and is an absolute gem. Not only are so many free, but they are in short handy 10 minute clips that give you a boost of knowledge just when you need it. Stuck on something? Search Railscasts and you’ll almost certainly find something that helps! Recently Ryan announced a RailsCasts Pro Subscription, where subscribers get access to additional content and screencasts (at a very reasonable $9 a month). Needless to say the free episodes are essential, and if you can afford it so is the pro-subscription, but if you can’t, it still gets a highly recommended. Check them out here.

I LOVE the official Rails guides. They are well written and are full of first-class info (especially good for making notes). Originally I thought I’d just refer to them as and when I got stuck on anything, but since they are now available in .mobi, I have started to read them from start to finish on my Kindle – and they have quickly become one of my favourite Rails ‘books’! Don’t look down on them because they are ‘just’ the official guides – they’re essential – miss them at your peril.

Finally, use the Rails API when you need to dig a bit deeper and get help on the specifics.

You’re well on your way – keep at it!

You are well and truly on your way to becoming a hot Ruby and Rails dev. Carry on with RailsCasts, think about joining Code School and giving the Ruby Mendicap University a go too. Keep an eye on other screencasts and material that (often!) pop up in the Ruby and Rails world as well – to keep current. But above all, keep making things – the more you do the more things will sink in.

There are probably lots of great resources that I have missed (or just haven’t got around to yet) so ask around, read Amazon reviews, give anything a go you get a good feel from or the community rate highly.

Here are a few more resources that come highly recommended (all are on my own to-do list) you might want to check them out too:

  • The Ruby Programming Language – By David Flanagan and Yukihiro Matsumoto (the creator of Ruby)
  • Peepcode – Screen casts on Rails and other related topics
  • Programming Ruby, aka the Pickaxe book – by Dave Thomas, with Chad Fowler and Andy Hunt
  • Rails Recipes: Rails 3 Edition – by Chad Fowler (I’ve just started this book – like it already!)
  • Crafting Rails Applications – by José Valim

Good luck!

Advanced Ruby & Rails books? If you’re looking for advanced material, then you’re in luck, cos I’ve started a post on that too: Advanced Ruby & Rails books