Ruby on Rails Tutorial, second edition (updated for Rails 3.2)

Jan 20, 2012 • posted by Michael Hartl

UPDATE: A full draft is now available.

Since launching the Ruby on Rails Tutorial in 2010, I've been gratified by how many people have used it to learn web development with Ruby on Rails. Some people thought I was crazy to make the whole book available for free online, but the many readers who bought the PDF and screencasts have shown that it wasn't so crazy after all. (And to those who have apologized to me for only using the free version: Dude, that's why it's there!) Thanks to everyone whose goodwill and support have made the Rails Tutorial project such a success.

Recently, many people have been asking when the tutorial will be updated for the latest version of Rails, and I'm pleased to announce the beta release of the second edition of the Ruby on Rails Tutorial book, fully updated for Rails 3.2 and Ruby 1.9. This initial release consists of the first five chapters, and each week I plan to release 1–2 additional chapters until the full book is out. Sign up for the Rails Tutorial News Feed to be notified when new chapters are ready.

New features

The second edition includes many new features:

  • Fully updated for Rails 3.2 and Ruby 1.9
  • Coverage of the new asset pipeline
  • Behavior-driven development (BDD) with Capybara and RSpec
  • An introduction to Cucumber for writing client-friendly tests
  • Syntactically Awesome Stylesheets with Sass
  • Better automated testing with Guard and Spork
  • Rolling your own authentication with has_secure_password

After people have had a chance to read it and give feedback, I'll roll up the result as a PDF and start production on the new screencasts. Sign up for the Rails Tutorial News Feed to be notified of new product releases.

Bug reports

One of the great things about publishing early and often is being able to fix errors reported by readers. The first edition of the Rails Tutorial benefited tremendously from the help of thousands of early adopters, and I'd love to have your help with the second edition as well. If you find bugs or typos in the new edition, please send a report by email to [email protected]. (By the way, please don't report broken cross-references such as Section \ref{sec:name_of_the_section}; these will all be fixed by the time the book is done.)


Q: Will the new edition of the Ruby on Rails Tutorial be free to previous purchasers of the PDF or screencasts?

A: The second edition PDF and screencasts will be a paid upgrade, but current customers will receive a significant discount on the new products. And, as always, the online version of the book will be free.

Q: When will the new PDF and screencasts be ready?

A: The new PDF should be ready in the next month or two, and I'm hoping to release the new screencasts in late winter or early spring, which means they'll be ready by fall for sure. ;-)

Q: I'd like to buy the Rails Tutorial PDF/screencast bundle and get started now. Can I get the new edition for free when it's ready?

A: Email me when the time comes and we'll work something out. I'm not sure about "free", but I can probably give you an extremely generous discount.

Q: What is the biggest difference in the new edition?

A: The biggest change in the new edition isn't the upgrade to Rails 3.2 or has_secure_password, it's the new (and much slicker) programming style for the RSpec code. The results are quite pretty, as you'll see starting in Chapter 5.

Q: The first edition of the book had 12 chapters. Why does the new edition only have 11?

A: The new edition was able to eliminate a lot of the old secure password material because of the awesome has_secure_password method added in Rails 3.1, allowing the User model material from Chapters 6 and 7 to be combined into a single chapter.

Q: Does the new edition cover CoffeeScript?

A: No. The first edition barely has any JavaScript, so there's little point in adding new material on CoffeeScript to the second edition. This may be a subject for future products, though.

Q: You've mentioned that PolyTeXnic, the markup system used to make the Rails Tutorial book, will eventually be released as an open-source project. When will it be ready?

A: I don't have a specific timeline for the release of PolyTeXnic, but I can tell you that my plans in this direction have become more ambitious, not less, so everyone interested in PolyTeXnic can rest assured that, once there is news, it will be good. (Sign up to be notified when there is some.)

Q: I've found a bug or typo. Where should I report it?

A: Please send all bug and typo reports to [email protected].

Q: Do you have any plans for future products?

A: I do. Sign up for the Rails Tutorial News Feed to be notified of future releases.

Q: Where's the new edition located again?

A: It's here: the second edition of the Ruby on Rails Tutorial book. Enjoy!