with {:ok, record} <- Ash.get(resource, record_id, authorize?: false) do
# Merge relationships into attributes as arguments for the action
action_input =
attributes
|> MapUtils.atomize_keys()
|> Map.merge(prepare_relationship_arguments(relationships))
changeset =
record
|> Ash.Changeset.for_update(action_name, action_input)
|> Ash.Changeset.set_context(%{source: :mobile_changeset_apply})
Ash.update(changeset, %{}, authorize?: false)
end
with {:ok, record} <- Ash.get(resource, record_id, authorize?: false) do
# Merge relationships into attributes as arguments for the action
action_input =
attributes
|> MapUtils.atomize_keys()
|> Map.merge(prepare_relationship_arguments(relationships))
changeset =
record
|> Ash.Changeset.for_update(action_name, action_input)
|> Ash.Changeset.set_context(%{source: :mobile_changeset_apply})
Ash.update(changeset, %{}, authorize?: false)
end