Update the code to work with Rails 4.

Hi,

I was playing today with the Gem and notice that there are some changes that are required to make it work in Rails 4. I did these changes and make sure that the specs are passing. 

Cheers!