from Hartl rails textbook.