Compatibility with Rails 4.2beta

@kratob Can you please sanity-check my changes.