In This Chapter
Creating a Web site to store personal data
Viewing and modifying a Rails model
Programming for a model with Ruby
Here's a list of things that come in sets of three:
Stooges: Curly, Larry, Moe
The number of strikes until you're out: Strike one, Strike two, Strike three
Things that influence the price of a house: Location, Location, Location
Monkeys: See no evil, Hear no evil, Speak no evil
People involved in a love triangle: Person 1, Person 2, Person 1's best friend
Books in the Hitchhiker's Guide “trilogy”: Guide, Restaurant, Universe, Fish, Harmless
Items that would be in this list, if the list were more concise: Stooges, Strikes, Houses
Parts of the Rails framework: Model, View, Controller
In case you missed it, the last item in the list is the most relevant. Chapter 5 deals with the view and the controller. This chapter covers the model — the supreme item in the Rails triumvirate.
To make the discussion concrete, this chapter uses one big example — a Web site that stores photographs.
Here's my completely unoriginal idea: Create a Web site that displays photos. Initially, each photo entry has its own
filename and its own
filename refers to an image file on a hard drive. (For example,
niagara_falls.jpg may be a
description tells you something about the photo. (“Alan beats me up on our trip to Niagara Falls with Mom and Dad watching in the background.”)
This chapter ...