Delete command on relation should return all deleted entities

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?

Hmm, does it work when you do relation.command(:delete, result: :many).call?

Hi @solnic - that solved it. However, it’s odd that the source describes and implies a different result?

@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.

Yes, this is weird. For me it also returns many result when passing nil. Worth noting :one and :many are available options as stated in the docs. So im using :one as default value.

# ROM - Ruby Object Mapper
gem "rom-rails", "~> 1.1.1"
gem "rom-sql", "~> 2.4.0"
 # @option opts [Symbol] :result (:one) Set how many results the command should return.
 #                                       Can be `:one` or `:many`

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?