rom-rb/rom

Pass command options to changeset

qortex opened this issue · 1 comments

We could provide command options while constructing a changeset object. For now, options are not passed down to the command being built inside the changeset.

Examples

When result is supposed to be :many instead of the default :one value for the command:

rel.changeset(:delete, command_options: { result: :many } )
# or directly
rel.changeset(:delete, result: :many )
# or
rel.changeset(:delete).with_command_options(result: :many)

Right now, it is not possible with the current changeset implementation (arguments are considered data, see this file) so we have to circumvent:

c = rel.changeset(:delete)
c.command_options[:result] = :many
c.commit