following to Rails tutorial.