Closed seantanly closed 2 years ago
Looks like the to_equal/3
function is recently fixed. 👍
This PR in addition adds unit test for that and fixes the defdelegate for embed_as/2
. Also applied mix format
based on elixir 1.13.
I have published ex_money_sql version 1.5.2 with the following changeling entry:
c:Ecto.ParameterizedType.embed_as/2
callback for the Ecto.ParameterizedType
behaviour. Thanks to @nseantanly for the report and the PR.Thanks for the report and the PR, much appreciated!
The default implementation from Ecto for
Ecto.ParameterizedType.equal/3
is doingwhich results in changeset wrongly reporting changes although params passed are equal to model's value when compared using
Money.equal/2
.Instead,
Money.equal/2
should be used for money comparison.Ref: https://github.com/elixir-ecto/ecto/blob/dc568c3b619a71511b275e609c89e530c011da04/lib/ecto/parameterized_type.ex#L190
Also added function head and base implementation for
embed_as
that is defdelegated fromMoney.Ecto.Map.Type
toMoney.Ecto.Composite.Type
.