Hey,
I want to use the update changeset, but want to skip the tuple-diff-check, which results in a extra sql, of the tuple, which is too expensive?
Is that possible? Or do you recommend not using changesets in that case?
What do you think about following workaround (using command and changeset)?
update(id, items.changeset(Changesets::UpdateObjectChangeset, item).to_h)
Here’s my custom changeset:
module Test
module Repositories
module Changesets
class UpdateObjectChangeset < ROM::Changeset::Update
include Deps["current_time"]
map do |tuple|
tuple.except(:id, :created_at).merge(updated_at: current_time)
end
end
end
end
Another related question:
How to apply the changeset to an array of tuples? Following…
items.changeset(Changesets::UpdateObjectChangeset, items) # items is an array
fails with …
NoMethodError:
undefined method `except' for [] at the custom changeset
Thanks