Has anyone here had luck casting a Money.Ecto.Composite.Type
in a changeset?
schema "orders" do
field(:price, Money.Ecto.Composite.Type, default: Money.new(0, "USD"))
end
def changeset(order, attrs \\ %{}) do
order
|> cast(attrs, [:price])
end
attrs
contains
%{"amount" => 10, "currency" => "USD"}
For the life of me, I cannot seem to get this to cast as expected. price
is never set in the changeset.