Changes to Ecto models
I have a model with a string field that must be at least two characters long:
def changeset(model, params \\ :empty) do
model
|> cast(params, @required_fields, @optional_fields)
|> validate_length(:name, min: 2)
end
The problem is that changeet.errors, when legitimately populated, returns:
[name: {"should be at least %{count} characters", 2}]
Is this a bug, if not how can I interpolate this tuple?
+3
source to share