When applying DDD principles in Ruby, I feel that Active Record pattern ends up polluting the domain model, while I'm not sure how to implement JSON deserialization without breaking encapsulation.
The Data Mapper pattern could be an alternative, but I haven't found any satisfactory Ruby implementation that fulfills my Database requirements.
ActiveRecord usual implementation introduces persistence concerns on the domain entities, while separating domain entities and Active Record entities creates a duplicated class hierarchy, among other additional complexities.
With JSON deserialization, I either need to allow an empty constructor and public setters, or I need to give the Aggregate class the responsibility of deserializing JSONs, which doesn't seem as a legitimate domain concern, but more of an infrastructure concern. I understand this should be a Repository responsibility, but I don't see how to implement this without breaking the encapsulation of the aggregate class.
Perhaps the alternative would be to use Event Sourcing instead of persisting the aggregates states, or only persisting the aggregate state for read purposes. Is this correct?