More complex changes done atomically?

Something like this would do what you want:

change atomic_update(:string_attribute_a, expr("A." <> atomic_ref(:some_integer_id))
change atomic_update(:string_attribute_b, expr("B." <> atomic_ref(:some_integer_id))

In general, though, you can often get more flexibility by extracting to a module change

defmodule MyApp.Changes.SetValues do
  use Ash.Resource.Change

  def atomic(changeset, ....) do
     {:atomic, %{
        string_attribute_a: expr(...),
        string_attribute_b: expr(...),
     }}
  end
end
2 Likes