You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an Ecto schema with a Money.Ecto.Type field and noticed the following:
When rendering a changeset from the schema without errors, field_value returns a Money struct.
In the presence of an error (on another field), it returns the value represented as a string like "0.80".
This broke a custom field render function of mine.
Note that the behaviour has been changed by upgrading ecto (!) from ref "52b354" to 2.1.4. Previously, field_value would always return Money structs.
The new behaviour is possibly desired, if so I would like to understand why.
The text was updated successfully, but these errors were encountered:
In any case, this behaviour is desired because in case of errors, you want to show what the user typed, and what the user typed may not be a valid type/struct, exactly in case of errors, so you need to be able to handle raw values in your input.
Hello,
I have an Ecto schema with a
Money.Ecto.Type
field and noticed the following:When rendering a changeset from the schema without errors,
field_value
returns aMoney
struct.In the presence of an error (on another field), it returns the value represented as a string like "0.80".
This broke a custom field render function of mine.
Note that the behaviour has been changed by upgrading ecto (!) from ref "52b354" to 2.1.4. Previously,
field_value
would always returnMoney
structs.The new behaviour is possibly desired, if so I would like to understand why.
The text was updated successfully, but these errors were encountered: