From the Agile Rails 4 book