Chapter 5. Expanding the Rails code, RESTfully
David Heinemeier Hansson
In this iteration, we’ll finally learn about this RESTful stuff we’ve been talking about, as we add new models and controllers for the tasks, projects, and locations, along with the migrations needed to create their database tables. We’ll also address some basic security concerns that need to be considered at the outset.
Before we dive in and create the model classes and migrations for tasks, projects, and locations, I want to give enough background about REST and how we’re using it in this book. I’ll start with a disclaimer.
Readers who are REST experts and/or went to Scott Raymond’s excellent “Doing REST Right” RailsConf 2007 presentation[1] may, at various points in this iteration, be tempted to scream “What about idempotence?” “You should be returning status codes, not just sending XML responses,” or “REST isn’t about CRUD and respond_to, but you’re making it seem like it is!” I ask those readers to please bear with me: Explaining REST properly would take a full book. Thankfully, an excellent one is already available: RESTful Web Services, by Leonard Richardson and Sam Ruby (O’Reilly Media, 2007). If you care about REST, buy that book[2] and read it. You can also read one of many good articles[3] about REST online. Then, as you read this iteration, you can shake your head knowingly when I oversimplify things.