rom-rb / rom

Data mapping and persistence toolkit for Ruby
https://rom-rb.org
MIT License
2.08k stars 161 forks source link

Changeset crashes when an array is passed to associate #530

Closed solnic closed 5 years ago

solnic commented 5 years ago

To Reproduce

# assuming `projects "has_many :tasks"`
changeset = projects.changeset(:create, name: "Test")
  .associate([{ title: "Test" }], :tasks)

changeset.commit

Expected behavior

It should persist the project along with its tasks.

solnic commented 5 years ago

After some digging I realized it's not a trivial issue to solve and it's not obvious how it should work. There are some API considerations too here, so this is not just a bug-fix but actually a whole, complex feature to implement. I'll report another issue and schedule it for 6.0.0. For now I made it raise a NotImplementedError because previous crash was confusing.