example code from the rails book