Create commands with result :none

Hey,

I have the use-case of returning nothing from a command. Here’s an example of an bulk-update-command:

def update_status(old_status_id:, new_status_id:)
  records
    .where(status_id: old_status_id)
    .command(:update)
    .call({ status_id: "created" })
end

I don’t know how many records will be updated and I don’t want all data records to be queried with a select at the end. At the moment you can’t prevent that. You have to choose between result: :one(default), or :many.

What do you think? Did I miss something?

Thank you and best regards!

I wanna know this too. I don’t need the appended SELECT query after INSERTing multiple records.

1 Like