Rails 4.1 support

For those interested, my branch should work with rails 4.1.6.

It doesn't work with Rails 4.2.0.beta2

I'm making this PR to run tests on Travis CI