Rails 4.2 compatibility

WIP until 4.2.0 is released.