As a web application development framework, Ruby on Rails is tremendously helpful for building web applications, but only if you understand the problems it solves and how it solves them.
Sadly, most guides dive right in with Rails, showing what it does, rather than why or how it does it. This is helpful if you're only ever going to do exactly what you see in the book, but falls pitifully short if you want to apply these tools to whatever problem you come across.
So our reason for writing this book is different than that of other guides. This is not a manual to show every last thing you can do with Rails, but instead a journey behind the scenes to see what life in a web application is like without Rails, a journey to understand why web application frameworks exist. You'll see the pains that arise when building a web application without a framework, so that when the conventions are introduced, they make sense, because you can now see them in context.
In short, we wrote this book because we believe that before you do it with Rails, you need to understand how to do it without.
If you've been interested in Rails or even played with it a bit, but don't quite feel like you "get it", then this book is for you. This book also works well as review material, so even if you are familiar with Rails, there is still some benefit to gain from reading this book. It does expect that you have a basic understanding of the following:
Each of the concepts listed above are crucial for understanding the content of this book. Please make sure that you thoroughly understand those concepts before moving onto the main content of this book. If you feel that you do know the material above, but that you're somewhat rusty on that material, then it may be a good idea to review things first.
The book is divided into two parts:
In "No Magic Rails" we aim to use very little in the way of Rails conveniences. We'll start with some web application basics, then move to writing a simple blogging application.
The goal in this first section is to painstakingly build a web application without using any conventions or conveniences provided by Rails. This process exposes fundamental web development concepts, revealing many of the pains that Rails seeks to alleviate.
And as we write our blog app, we'll see all of the pieces. What's more, we'll start to notice some duplication and a few different patterns, and refactor accordingly as we go.
Then in the second half, "Rails Core Conventions", we'll go back through our complete blog application, armed with the knowledge of those patterns. This time through, we'll better understand the problems they relate to, and rewrite our app using everything Rails has to offer.
But Rails is more than just the tools it provides; its conventions give us a way of thinking about web applications and an organizational structure for implementing them. The real power here comes from understanding the reasons for and the mechanisms of the framework, so that you're able not only to use it, but also adapt it to fit your needs.
By the time you're done reading this book, you'll understand the most important conventions in Rails, but more importantly, you'll understand why they exist. If this sounds good to you, then it's time to head to the next section, where we'll do a quick review of HTTP before we get underway!