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:
- AR::Base includes Enumerable
- Add a method to declare a list of method names that should be treated as hash keys
eachto 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.