About this book
This book will teach you everything you need to know about the Ruby on Rails web framework.
Ruby on Rails is a leading web application framework built on top of the fantastic Ruby programming language. Both the language and the framework place an extreme emphasis on having a principle of least surprise and getting out of the way of the developers using it.
Ruby on Rails has been growing at a rapid pace, with large internet companies such as GitHub and Twitter using it for their core functionality. With the latest release of Rails, version 6.0, comes a set of changes that improve the already brilliant framework that has been constructed over the past sixteen years. The fantastic community around the framework has also been growing at a similar pace.
This book is designed to take you through developing a full-featured Rails application from step one, showing you exactly how professionals in the real world are developing applications right now.
Who should read this book
This book is primarily for those who are looking to work with the Ruby on Rails framework and who have some prior experience with Ruby, although that is not entirely necessary. The chapters get more and more advanced as you go along and provide a smooth learning curve in order to teach you how Rails applications are built.
If you’re looking for a book that teaches you the same practices that are used in the real world, then this is the book you are looking for.
What’s new in the third edition
Wow, sixteen years of Rails. That’s a long time in software!
A third edition for a Rails book is not just a matter of fixing up typos, images and other things. It almost requires an entire rewrite of the whole thing. We’ve split up some chapters, removed others, and touched up the rest. Everything has been pored over and vetted by authors and volunteer reviewers, yet again.
We have spent hundreds of hours around updating this book, and all just for you. We hope you like it.
TODO: Update once ToC is finalized
Chapter 1 introduces the Ruby on Rails framework and begins to show how you can develop the beginnings of an application.
Chapter 2 shows off test-driven development and behaviour-driven development, which are two core concepts that’ll be used throughout the remainder of this book and that can be applied instantly to any Ruby and Rails code you may write in the future. By testing the code you write, you can be assured that it’s always working in the expected way.
Chapters 3 and 4 discuss the application you develop in this book - a project-management app of sorts - and delve into the core concepts of a Rails application. They also look at developing the first core features of your application.
Chapter 5 begins an introduction to nested resources, building on top of the features developed on the previous two chapters.
Chapter 6 shows you how to style that application using the wonderful Bootstrap design framework. With not-so-much-effort, we can get a decent looking design for our application very quickly.
Chapter 7 introduces authentication, and uses the Devise gem to implement features such as requiring users to sign in to the application before they can perform certain tasks.
Chapter 8 builds on the work in Chapter 7 by adding authorization to the application. There will be new areas of the application that are accessible only to a certain kind of user.
Chapter 10 builds not one but two new features for the application, adding the ability to comment on a ticket as well as track the ticket’s lifecycle through varying states.
Chapter 11 begins our foray into dealing with email in a Rails application. You’ll see how Rails makes it easy to send email using a part of its framework called ActionMailer.
In Chapter 12, you add a feature that lets users assign tags to tickets so they can be easily grouped. You also add a feature to allow users to search for tickets matching a certain state, tag or both.
Chapter 13 involves deploying the application to Heroku:https://heroku.com, a well-established hosting provider that offers a free service. This chapter also introduces Continuous Integration through GitHub Actions, which will run the tests for the application and deploy the application to Heroku if all the tests are passing.