Sorry that this is not an Ash 3 issue.. I just didn’t had the time yet to port this project to it.
I have this embedded resource:
defmodule CoreWeb.Trash.FeedbackLive.UnderwritingFeedback.FirstStep.Resource do
@moduledoc false
alias CoreWeb.Trash.FeedbackLive.UnderwritingFeedback.FirstStep.Resource
use Ash.Resource,
data_layer: :embedded
attributes do
alias Core.Ash.Types.Currency
attribute :flip_arv, Currency, allow_nil?: false
attribute :flip_repair_estimate, Currency, allow_nil?: false
attribute :rental_repair_estimate, Currency, allow_nil?: false
attribute :monthly_rent, Currency, allow_nil?: false
attribute :annual_rent, Currency, allow_nil?: false
attribute :mao, Currency, allow_nil?: false
end
actions do
alias Resource.Changes
create :create do
primary? true
accept [:flip_arv, :flip_repair_estimate, :rental_repair_estimate, :monthly_rent]
argument :config, :map, allow_nil?: false
change Changes.CalculateMAO
end
end
end
And this is the change:
defmodule CoreWeb.Trash.FeedbackLive.UnderwritingFeedback.FirstStep.Resource.Changes.CalculateMAO do
@moduledoc false
use Ash.Resource.Change
@impl true
def change(changeset, _, _), do: Ash.Changeset.before_action(changeset, &do_change/1, append?: true)
defp do_change(changeset) do
dbg(changeset)
config = Ash.Changeset.get_argument(changeset, :config)
flip_arv = Ash.Changeset.get_attribute(changeset, :flip_arv)
yearly_rent = Ash.Changeset.get_attribute(changeset, :yearly_rent) |> dbg()
Ash.Changeset.change_attribute(changeset, :mao, Money.new(12312))
end
end
I use this resource as an “intermediary” step in a multi-step form.
When I try to run AshPhoenix.Form.validate on it, it will run the action but not the changes. Why is that? Is this by design? I would expect that it would run all changes during a validate call.






















