To be specific I was trying to localize the Custom Methods example here. I found a similar question but I don't know how to pass that :message argument in errors.add() method. I tried doing something like this:
errors.add(:discount, message: :greater_than_value_error)
but it prints:
{:message=>:greater_than_value_error}
instead of printing the actual error message that was in the .yml file.
What should be the correct syntax here?
My .yml file looke like this (not sure whether this piece below is 100% accurate):
activerecord: #try to use activemodel here
errors:
models:
invoice: # or namespace/model_name
attributes:
discount:
greater_than_value_error: "can't be greater than total value"