From "Agile rails 4" book