From Chapter 2 of Railstutorial