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?
This one's slightly frustrating. I had to `require 'rails'` in the tests. This is because in Rails 4.1, `ActiveRecord::Base.establish_connection` assumes it can call `Rails.env` if `Rails` is defined (which then causes an exception in the tests).

This unfortunately has the side effect of defining `Rails.application`, but leaving it `nil`, which means that branch gets run instead, and you get `application:NilClass` in the logs.

I'm not super keen on adding this extra guard in the production code. It seems pretty unlikely people will have a codebase where `Rails.application` isn't configured.

That said, I can't see a great way round this. The options I can think of are:

* Change the testing approach to use actual Rails apps of each version (instead of just requiring the necessary bits of Rails)
* Assign some constant to `Rails.application` in the tests. If this doesn't cause any weird behaviour, we'll hit that side of the conditional and print out something useful
* Stick with this extra condition in the production code

Thoughts?