No validation of options specified in validate_number()
There is no validation of options specified in validate_number(changeset, field, opts).
According to the documentation, only the following options are allowed:
:less_than
:greater_than
:less_than_or_equal_to
:greater_than_or_equal_to
:equal_to
:message
However when incorrect options are used, such code fails silently (it doesn't validate and it doesn't fail at compilation) - there is no indication that something is wrong:
def changeset(model, params \\ :empty) do
model
|> cast(params, @required_fields, @optional_fields)
|> validate_number(:duration, min: 10, max: 60000)
end
Is it for some reason or could it be improved?
I could definitely be improved.
Do you plan to implement it or do you need some help?
Please try a pull request if you would like to. I won't have time to tackle this one soon.
Fixed in master.