I am currently working on an Elixir project with multiple currencies; I need currency code with the amount from form input to cast directly using changeset. However, I discovered that form sends money in a string format similar to this "$99", which cannot be cast by the Money.Ecto.Map.Type type as it expects map. So, I believe it should send the value as a map, similar to this %{"amount" => 99, "currency" => "USD"} so that it can be easily cast by changeset when the type is Money.Ecto.Map.Type.
Same issue happens when we use Money.Ecto.Map.Type
Currently, I have to update form input values explicitly into map to cast them in changeset.
I am currently working on an Elixir project with multiple currencies; I need currency code with the amount from form input to cast directly using changeset. However, I discovered that form sends money in a string format similar to this
"$99"
, which cannot be cast by theMoney.Ecto.Map.Type
type as it expects map. So, I believe it should send the value as a map, similar to this%{"amount" => 99, "currency" => "USD"}
so that it can be easily cast by changeset when the type isMoney.Ecto.Map.Type
.Same issue happens when we use
Money.Ecto.Map.Type
Currently, I have to update form input values explicitly into map to cast them in changeset.