Chapter 5. Extending Views
So far, you’ve experienced amazing power in a short time. Rails Active Record has let you build surprisingly capable models with no more than a handful of lines of code. Scaffolding used the metaprogramming capabilities of Ruby in concert with the metadata in Active Record to instantly slap a web face on our database tables. The Rails generators and glue code kept the structure consistent and provided the necessary tools to develop and debug the application at every step of the way. Now that we have scaffolding in place for our database tables, its time to start replacing that scaffolding interface with a prettier interface—one that lets us manipulate the relationships between our tables.
This will happen faster than you might think; now the fun really begins, as our web application’s user interface rapidly take shape. In this chapter, you will see how to:
Take control of the views rendered through scaffolding
Handle relationships in our views
Make a simple change to Rails routing
The Big Picture
Let’s step back for a moment to examine the processing steps that occur from the time the server receives a URL request to when Rails finally returns the resulting HTML response (affectionately know as the big picture):
The web server receives a request from the browser. A request consists mostly of a URL and some optional parameters (which may or may not be part of the URL).
The web server is normally configured to serve static resources ...