Updated: April 2024
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 books 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 a lifetime ago). Here I recommend what I consider to be the best Rails books out there today.
A word about Rails versions
Ruby on Rails 7 was recently released. While a lot of great Ruby on Rails books out there target Rails 4, 5, and 6 do not make the mistake of buying an obsolete Rails book if you intend to develop with version 7.x of the framework.
Substantial changes were introduced in each major version of the framework so learning with obsolete material will be an exercise in frustration. Trust me on this.
If you are looking for a Ruby on Rails video course, instead of a book, scroll down to the bottom of the page where I include what I consider to be a couple of the best Ruby on Rails courses ever created.
Recommended Ruby on Rails books ordered by difficulty level
Title: Ruby on Rails Tutorial (Rails 7)
Level: Beginner programmer | No experience with Rails
Type: Tutorial
The Ruby on Rails Tutorial is one of the clearest, nicest introductions 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 7, 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 Addison-Wesley publishes a printed edition. 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.
Free HTML version | Ebook + Videos | Printed version (Pre-Order)
Title: Agile Web Development with Rails 7
Level: Intermediate programmer | Some experience with Rails
Type: Tutorial
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 evolved over the years to reflect changes in the framework and the industry, always promoting best practices in the process.
Title: The Rails 7 Way
Level: Intermediate programmer | Some experience with Rails
Type: Reference
Those of you who already have a basic understanding of how Rails works – which you may have acquired by reading the official guides and tutorials, writing some sample apps, or studying one of the books listed above – might want to bring your knowledge of the subject up to a pro-level by reading Obie Fernandez’s classic “The Rails 7 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 updated edition with a couple of brilliant co-authors) 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.
Title: Rails 5 Test Prescriptions: Build a Healthy Codebase
Level: Intermediate programmer | Some experience with Rails
Type: Tutorial
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 are at least somewhat familiar with Rails already. Rails 5 but the testing approach hasn’t really changed with the newer version, so most of the information is still very much relevant.
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.
Which Rails book should I buy?
Unless you’re already an experienced programmer, start with the Rails Tutorial. After you’ve completed the tutorial, you may want to further refine your skills and learn best practices with The Rails 7 Way and Rails 5 Test Prescriptions: Build a Healthy Codebase.
Alternatively, if you are already a programmer, you might find Agile Web Development with Rails 7 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.
At that point, you can start reading specialized books. For example, with Modern Front-End Development for Rails or High Performance PostgreSQL for Rails, just to name two.
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.
Recommended Ruby on Rails course
I love taking online courses and over the years I have taken the majority of the often recommended Ruby on Rails courses. Which one is best? It’s all subjective, of course, but I and many other developers in the community have reached the conclusion that Ruby on Rails 7 by The Pragmatic Studio’s duo Mike and Nicole Clark is very hard to beat.
In this recently updated Rails course, you’ll learn everything you realistically need to know to get started building web applications with Ruby on Rails. The authors build a complete web application on video and then guide you to build a similar, but separate application in the exercise sections.
So you end up with two web applications, and in the process, you’ll learn a lot about Rails and current best practices, including testing and deployment.
Not cheap but absolutely worth the price of admission.
What about Hotwire?
Hotwire is the default front-end for Rails. A combination of technologies that allow you to write SPA-like applications in Rails without dealing with the JavaScript ecosystem. It’s cool tech that will massively simplify the front-end development of your Rails applications.
From the same dynamic duo above (Mike and Nichole), I can’t recommend high enough their Hotwire course. They explain everything in detail and in simple terms as well as distilling best practices.
I came into their course already familiar with the subject and still learned a few tricks. They are quickly establishing themselves as my favorite course content creators and I’m lucky that they tend to use the same technologies I tend to opt for myself (chiefly Ruby and Elixir).