From the tutorial at http://ruby.railstutorial.org