Added functionality from Railscast.

https://app.asana.com/0/11169835259596/11423458506252