From Chapter 3 of the RoR Tutorial