In Ecto.Changeset the validation functions often use a message/2 function when adding error messages, as follows:
if repo.one(query) do
add_error(changeset, hd(fields), message(opts, "has already been taken"),
validation: :unsafe_unique, fields: fields)
else
changeset
end
:
:
I feel silly asking this, but I’m writing some new validation functions for my app, and I’ve not been able to find a definition for this message/2 function. What are the opts it accepts, etc…? Where is that function message/2 defined? I know that it just outputs a string, so I can just interpolate an appropriate string, but is there functionality via ‘opts’ that I should be using?
Thanks – Michael W