Make compatible with Rails 4.1 and bump Travis config

I've had a go at this, and got it working. Supporting the many versions of Rails is getting a bit tricky, but still doable (adds conditionals in a few places). I'd be really interested in your thoughts on how long to keep support for (eg) 3.1.

@arthurnn You okay to review?