Minor fixes for Rails 3.2 compatibility

Hey Dan, big fan of your writing, came across this repository of yours and integrated it into one of my own projects. It needed some slight tweaks to get it working with Rails 3.2.x, so I've included them here.