include Enumerable in AR::Base?

See https://github.com/rails/rails/pull/5345 for https://github.com/rails/rails/issues/5381 for background.

AR models live somewhere between simple data structure (Hash) and domain objects with arbitrarily complex behavior.#5345 introduces slice to the model API, which makes it feel more like a data structure. I propose that:

  1. AR::Base includes Enumerable
  2. Add a method to declare a list of method names that should be treated as hash keys
  3. implement each to iterate over the attributes hash with the declared methods (and their values) merged in
    This would effectively allow users to pass AR models to any method that operates on a Hash.

Thoughts?