This page is devoted to the best Ruby on Rails books for the reader who wishes to learn how to program in Ruby on Rails (the framework). You can also check out my page on the best Ruby books to learn about resources for Ruby (the language) on its own.
If you don’t have a Ruby foundation you may want to grab a book off the Ruby page, since approaching Rails without Ruby skills is not a wise idea. Rails is a web framework that’s written in Ruby for writing web applications in Ruby. Without knowing the language it’s hard to get the most out of the framework. If you can, at least consider reading both a Ruby and a Rails book at the same time (if you’re in a rush to learn Rails).
Over the past decade, Rails attracted a huge deal of attention among developers and with it came plenty of new titles on Amazon’s virtual shelf. Having programmed with Ruby on Rails since December 2004, I have read quite a few Rails books over the years (and even wrote one of my own at some point). Here I recommend what I consider to be the best Rails books out there today.
A word about Rails versions
Ruby on Rails 5.2 was released recently. While a lot of great Ruby on Rails books out there target Rails 2, 3, and 4, do not make the mistake of buying an obsolete Rails book if you intend to develop with version 5.x of the framework.
Substantial changes were introduced in each major version of the framework, starting with a serious rewrite in Rails 3, so learning with obsolete material will be an exercise in frustration. Trust me on this.
The more conceptual Rails 4 books may still be somewhat worthwhile, but on this page, I’ve only included Rails books that target Rails 5 so that you can learn Rails through up to date books.
Recommended Ruby on Rails books ordered by difficulty level
The Ruby on Rails Tutorial is one of the clearest, nicest introduction to Rails ever written. It assumes that you have zero knowledge of Rails, however, it is still a great read for those who have some experience under their belt.
Proceeding step-by-step, the Rails Tutorial will progressively give you more confidence as it teaches you best practices in the process of building a fairly complex Rails application.
What I like about the Rails tutorial is that it doesn’t stop at teaching you Rails 5, but it actually delves into the tools that are typical of the Rails ecosystem (such as Git or deployment on Heroku). I’ve read plenty of Rails books and trust me when I tell you that you want this one to help you go from zero Rails knowledge to building your apps in Rails in a month.
Technically, this is a self-published Rails book but printed editions are put out routinely by Addison-Wesley. The book is also available online for free (legally), but that’s the HTML version only. For ebooks (in PDF, ePub and Mobi formats) you’ll need to buy a copy. The book also comes with a series of optional screencasts, which are not cheap but worthwhile since they give you the feeling of watching a Rails pro in action.
It’s worth noting that the author, Michael Hartl, has launched a subscription service called the Learn Enough Society, which includes this Rails book, as well as other programming resources. A good option for a beginner programmer.
This is the latest edition of the classic Agile Web Development with Rails book. The first Rails book to appear on the scene. It’s an excellent tutorial for intermediate and experienced developers, particularly if you like Agile methodologies and would like to gain a deeper understanding of the framework.
Most Rails programmers have leveraged this award-winning book to learn the framework at a time when, unlike today, Rails documentation was hard to come by. It’s a broad, far-reaching tutorial that has been evolved over the years to reflect changes in the framework and the industry, always promoting best practices in the process.
Those of you who already have a basic understanding of how Rails works – which you may have acquired by reading tutorials, writing some sample apps, or studying one of the books listed above – might want to bring their knowledge of the subject up to a pro level by reading Obie Fernandez’s “The Rails 5 Way”.
Obie is one of the top Rails programmers in the world, as well as an excellent teacher who placed a wealth of information in this great Rails book (now in its fourth edition) so that advanced programmers could get the most out of the Rails framework.
It’s an excellent, extensive reference that will be particularly useful to developers who are already confident about their Rails skills. A must-have for any serious Rails developer.
As you become more experienced as a Rails developer, you’ll start to realize the importance of testing your code base, so that you can change it and improve it over time with some degree of confidence.
Spend enough time in the community, and you’ll hear all sort of random terms like RSpec, Cucumber, Capybara, and even factory_girl. These are all excellent tools to help you test your code base but navigating these waters can be tricky if you are new to Test-Driven Development (TDD).
Noel Rappin wrote the definitive guide on how to test Rails code and build much more robust projects as a result. I can’t recommend this Rails book highly enough to those who already are at least somewhat familiar with Rails already.
Regardless of how many Rails books you read, or your current skill-level, every Rails developer should read the official documentation at some point.
The Rails API documentation when you are facing a specific problem (e.g., the arguments of a helper) and the Rails guides to get a much better understanding of the various components that make up the framework.
Alternatively, if you are already a programmer, you might find Agile Web Development with Rails 5.1 a more apt starting point to get up to speed with the framework. Then still get the other two books.
This combo of three Rails books would already put your Rails theoretical knowledge ahead of that of many Rails programmers.
As far as the practice goes, it all comes down to spending time writing code and doing so on your own projects (but reading other people’s code is also important to grow as a programmer). This way you’ll be able to gain practical experience with Rails that is backed by a solid theoretical foundation.