Chapter 3 onwards of the Ruby on Rails tutorial (http://ruby.railstutorial.org/)