Open fran-worley opened 7 years ago
I actually had a loooong chat with @solnic a few days ago and the plan is to get rid of Disposable and use ROM instead for domain-to-persistence operations. Cool? That could also be done step-wise by not relying on AR's crazy API but to base Disposable on Sequel's API and then add AR.
That sounds awesome but how would that work for people that by choice (or not!) are using AR or Sequel?
Given our mutual feelings on AR it makes more sense to me to do as you say and base disposable on a supported ORM and add AR in as an option.
You could come up with a common API and have adapters that implement it to support specific persistence libraries (AR, Sequel, rom-rb).
Sequel by design does not save entire object graphs. Its association modification methods are designed to be very direct and not offer a lot of abstraction.
Rather than creating the records inline, we need to support creating the associated objects and then adding them to the parent.
Another option would be to make use of the nested attributes plugin but that might be even messier...