Following along with Railscast #328 but ran into some errors.