module ActiveRecord
At some point this should be merged into ActiveRecord
or a gem should become available with this same functionality.
Original gist: gist.github.com/j-mcnally/250eaaceef234dd8971b Github Pull Request: github.com/rails/rails/pull/9052