so you want to build pizza dot net? try rails!

so you want to build pizza dot net? try Rails!

Hey everyone!  This is my last week as a ‘person of leisure’ before class starts up in full force next Monday.  I received a coursework invitation, and the first assignment is to answer the question: “How was your Rails tutorial?” to which I respond, “…which one?

Before I even saw the question I was considering a run-down on the Rails online tutorials I tried, what I learned, recommended order, and which ones are worth salt. So, here goes! These are roughly ranked in “do this first” order unless otherwise stated.

Michael Hartl – Rails Tutorial

oops my cow is upside down

oops my cow is upside down

This was the recommended tutorial for class, and sure enough it turned out to be the strongest guide so far, but I completed it last. Why did it take me so long to get started with Hartl? Even though the book is free and available online, the main page doesn’t reflect this well (in my opinion). So it took about a month to realize that I could just click the “read online” button and didn’t need to shell out $30, though I gladly did last week for a print edition. *shrug*

I do recommend this as a starting point. Immediate gratification plus in-the-weeds details. For one, Hartl uses a cloud integrated development environment (IDE) which means you don’t have to install Rails on your computer, yet, but you do get the experience of building and navigating all the files. Early in the game, you create two very simple Rails apps to prepare you for the third longer challenge to come (which gets pretty challenging, since you’re developing professional grade log-in and user authentication). You’ll learn testing, you’ll make a useful twitter-like app, and you’ll get some practice incorporating gems like ‘will_paginate’ and ‘faker’ (to generate fake users for testing). Hartl is the only one of the tutorials I completed to make use of Helper files, and does a good job of explaining what each of the auto-generated folders in Rails is for. I took away my clearest understanding so far of Rails MVC “flow” and how browser window –> routes –> controller –> model –> view.

How it differs from other tutorials (& why you shouldn’t give up if you get stuck or this feels hard):

  • The first tutorial I completed used scaffolding, and sure enough, I agree with Hartl’s perspective that scaffolding can be a powerful tool but is often overkill and doesn’t lend itself to deep understanding:

“When writing a Ruby on Rails tutorial, it is tempting to rely on the scaffolding approach—it’s quicker, easier, more seductive. But the complexity and sheer amount of code in the scaffolding can be utterly overwhelming to a beginning Rails developer; you may be able to use it, but you probably won’t understand it. Following the scaffolding approach risks turning you into a virtuoso script generator with little (and brittle) actual knowledge of Rails.”

  • You’ll code all the user authentication stuff (secure password hashes) by hand instead of using a gem like ‘devise.’ This made for a hair-tearing-out “why God I’ll never learn this” Chapter 8, but, it’s good for you. Like vegetables.
  • Unlike video tutorials, you read and follow along at your own pace, which means no skipping back 30 seconds to see “what did they just type??”
  • He coaches you to set up SQLite3 for development and PostSQL for Heroku, which is easy enough and allows you to bypass an otherwise inevitable migration step later (one I had to muddle through, when I did not do this).
  • You’ll finish with a professional quality, fully functioning and deployed twitter-like app. That link is so you can check it out if you’d like, it requires a sign-in so I’ll assure you that I won’t see your password (that function alone took an entire chapter) but I’m also not planning on using that app, so don’t get too excited about it.

As good and as thorough and lengthy as this book is, I still feel pretty unprepared to build a website from scratch. This may take a few readings to gel, plus a live instructor to bug.

Treehouse: Rails Developer Track

treehouse! where's my damn badge??

treehouse! where’s my damn badge??

This tutorial was actually a series of courses including html, javascript, the console, git, and ruby before you actually get to any Rails work. Once you get there, it’s heavily test-driven-development focused, and low on the instant gratification. You make a to-do list generator with log-in, so people can create accounts and create lists of things. This came in handy for me for my Robots app, which was a Code Fellows challenge. I pared it down into just one public list of robot parts.

The other problem I had with the videos in this course is there’s no accompanying slides or documentation, so if you’re following along you may have to watch at slowed-down speed, and even then I had a lot of wasted time where I had to back up 30 seconds and repeatedly pause to see what the instructor was typing.

On the upside, the accompanying courses were pretty useful, especially the ones on SQL and Active Records. This filled a knowledge gap that no other tutorial addressed in such detail. $25 a month or one trial month free. Oooh! I have a referral link for Treehouse, so USE THIS LINK if you want to check it out (50% off first month).

Code Academy – Learn Rails

I’m only 20% through this one, but it has a unique feature that I like: case studies! Again, you don’t build anything on your machine, you use their cloud IDE instead. The case studies are realistic and ask you to build actual apps that an organization might ask for (one a simple webpage with a home page and an “about” page, the next one similar but with some form data).

A note: the interface is really, really bad. Once you start a case study, it takes you immediately to the next one, when really you should go back to the preceding lessons first. And the file management is painful. So this is not the best tutorial, and probably should not be your first attempt, but I’m finding it gratifying practice after some of the others. (In the sense of: Look, I know more than I thought I did!)

Rails for Zombies, by Code School


Silly theme aside, this was actually pretty good, and free. They do a decent job of explaining CRUD and other Rails concepts. The big downside is that you don’t actually build anything (and building is half the battle). Still, I could see re-watching this or referencing the slides in the future. Like the Rails tutorial, the end result is a twitter-like app (…for zombies).

In Summary

Do the Rails Tutorial. Or, hell, learn JavaScript instead, or Sinatra if you must build websites with Ruby. Or just order a pizza and call it a night. Rails has been easy enough to learn when following directions, but a tougher transition for me to make into independent practice. There’s probably a name for this stage. I am confident that more will be revealed and this will all come together in the coming weeks. Stay tuned!