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 registered two changesets for a user account: one for creation with a required :password field, and one for update where the virtual :password field is not required (if no new password is set, I just dismiss this field and just update the other fields).
In the resulting form, the :password field is always set as required when editing an existing account, even though its associated changeset does not list it in validate_required().
If I change the default changeset method to remove the required field, I can see my form not showing password as required. Though it breaks the creation form where I wanted it to be required.
After a quick search through the code, the issue could lie around here:
required_list =
cond do
Map.get(res, :__struct__, false) ->
res.__struct__.changeset(res).required
true ->
[]
end
It should use instead the custom changeset functions if they were defined, using changeset() only as a fallback.
The text was updated successfully, but these errors were encountered:
I have registered two changesets for a user account: one for creation with a required
:password
field, and one for update where the virtual:password
field is not required (if no new password is set, I just dismiss this field and just update the other fields).In the resulting form, the
:password
field is always set as required when editing an existing account, even though its associated changeset does not list it invalidate_required()
.If I change the default
changeset
method to remove the required field, I can see my form not showing password as required. Though it breaks the creation form where I wanted it to be required.After a quick search through the code, the issue could lie around here:
It should use instead the custom changeset functions if they were defined, using
changeset()
only as a fallback.The text was updated successfully, but these errors were encountered: