joelvh
April 9, 2018, 11:59am
1
According to the code comments , the delete command should return the deleted entities. However, they return one.
relation.changeset(:create, {id: 1}, {id: 2}, {id: 3}).commit
result = relation.command(:delete).call
# => #<ROM::Struct::Event id="1">
That should be an array of all 3 entities, correct?
solnic
April 9, 2018, 12:00pm
2
Hmm, does it work when you do relation.command(:delete, result: :many).call?
joelvh
April 13, 2018, 12:14am
3
Hi @solnic - that solved it. However, it’s odd that the source describes and implies a different result?
joelvh
April 13, 2018, 9:49pm
4
@solnic I found today that relation.command(:delete, result: nil).call also returns an array as is expected based on the source code. For some reason, there is a behavioral difference between specifying nil and completely omitting the option altogether.
This is helpful! When delete is returning entities is it possible to have them return a custom representation other than ROM:Struct or plain hash?