Based on M. Hartl's Ruby on Rails tutorial.