Draft chapters of the Ruby on Rails Tutorial (3rd Ed.)

Aug 27, 2014 • posted by Michael Hartl

tl;dr: Draft chapters of the 3rd edition of the Ruby on Rails Tutorial are now available. I believe it’s the best edition yet. Sign up here for priority notifications and an exclusive coupon code.

In the past few years, the Ruby on Rails Tutorial book has become one of the leading introductions to web development. Both the 1st and 2nd editions have found broad audiences, and now I’m pleased to offer draft chapters of the 3rd edition, called Ruby on Rails Tutorial: Learn Web Development with Rails. For reasons detailed below, I believe it’s the best edition yet. A draft of the full manuscript is currently available:

The 3rd edition of the Ruby on Rails Tutorial will follow the same basic model as previous editions: a free online version, with ebooks and screencasts available for purchase. I also plan to produce a solutions manual for the book’s exercises, which will probably be included with one or more product bundles.

Perhaps the most surprising feature of the 3rd edition is that it is simultaneously easier and more advanced than previous editions. Whereas previous editions required readers to climb (sometimes unavoidable) brick walls, the 3rd edition is more like a ramp: smoothly increasing in difficulty, but ultimately reaching a greater height than before.

Here are the main factors that make the 3rd edition easier:

  1. Use of a standard integrated development environment in the cloud, with a pre-configured workspace specifically tailored to the needs of the Ruby on Rails Tutorial. Use of the custom Cloud9 IDE environment eliminates the installation and configuration overhead encountered in previous editions, while also providing the text editor, terminal window, and filesystem navigation necessary to complete the book’s three example applications.

  2. 100% default stack. The 3rd edition of the Ruby on Rails Tutorial uses the default Rails choices for all relevant technologies, thereby substantially reducing the configuration necessary to get started. The excellent but syntactically heavy RSpec testing framework has been replaced with the default Rails testing stack (MiniTest), making for a much gentler introduction to testing than in previous editions.

  3. Lighter-weight testing approach. The 3rd edition still covers test-driven development (TDD), but uses it more sparingly and judiciously. The more forbidding “wall of tests” sections have been eliminated, with concise and expressive integration tests (usually written after the application code) taking their place.

  4. Less emphasis on version-specific features. Rather than trying to incorporate mini-tutorials on new features for each version of Rails, the 3rd edition focuses on the most general principles of web development. This means that, although the tutorial does use the most recent Rails release, this fact is incidental, and it is not tightly coupled to the details of any particular version.

  5. Highlighted lines and red/green indicators. By making use of features of the underlying Softcover self-publishing platform, the 3rd edition of the Ruby on Rails Tutorial now includes highlighted lines in many code samples, allowing readers to see at a glance which parts of the code are most important. In addition, many code listings now include explicit labels indicating whether the test suite should be passing or failing at that point in the tutorial, thereby orienting the reader and making the exposition much easier to follow. (See Listing 3.12 for an example.)

Meanwhile, these are the main factors that make the 3rd edition more advanced:

  1. A completely rewritten chapter on login and authentication. The newly revised Chapter 8 covers all three of the most common login models on the Web: session expiration upon browser close, automatically remembering users, and optionally remembering users with a “remember me” checkbox.
  2. An all-new section on image upload. Chapter 11 now shows how to add pictures to the Twitter-style “microposts” developed in the tutorial’s main sample application. Topics include client- and server-side image validations, automatic image resizing, and using a cloud storage service (Amazon S3) in production.
  3. An all-new chapter on account activation and password resets, including sending email with Rails. The all-new Chapter 10 considerably extends the core sample application by adding account activation (thereby verifying the account’s email address) and allowing users to reset forgotten passwords. In the process, the chapter covers how to send email with Rails, both in development (using the server log) and in production (using SendGrid).

I’m more excited about the 3rd edition of the Ruby on Rails Tutorial than about any previous version. As reflected the new subtitle, Learn Web Development with Rails, I believe that the Ruby on Rails Tutorial constitutes not only a solid introduction to Rails, but also a thorough general introduction to web development. It wouldn’t be nearly as good as it is, though, without the contributions of hundreds (perhaps thousands) of readers who have taken the time to write in with bug & typo reports and other suggestions. As with previous editions, I thus look forward to getting feedback on the draft chapters of the 3rd edition of the Ruby on Rails Tutorial. And don’t forget to sign up here for priority notifications and an exclusive coupon code.