Add rails 4 support

Hello,

Here are the change I did for it to work with rails 4.

It seems to work pretty well. I didn't update the tests, any clue how to move them to the new  "dummy" testing way? I'm inexperienced with these.

Also, feel free to comment/improve whatever you see.