Ash FrameworkAF
Ash Frameworkโ€ข3y agoโ€ข
10 replies
\ แžตแžตแžต

Incrementing an attribute

What I have been doing is this:
change fn changeset, opts ->
  attempts = Ash.Changeset.get_attribute(changeset, :attempts)
  Ash.Changeset.change_attribute(changeset, :attempts, attempts + 1)
end

I did speculatively try this with expr as well: ๐Ÿ™‚
change set_attribute(:attempts, expr(attr(:attempts) + 1)

Is there another way to do this?
Was this page helpful?