rails 4 implementation of tutorial