ActiveRecord 4.x patch