Anyone has some tips as how to translate model associations in Rails?
For example: I have a Person model, which can have many Phone. However, a Person needs to have at least one Phone. I'm not able to translate that validation. The best I could do was this:
validates_presence_of :phones, :message => "At least one phone is required."
And on my YAML, I replaced this line to omit the %{attribute}:
format: ! '%{message}'
This way only my message is displayed, and I avoid the un-translated field name to be displayed.
This is causing me a lot of headache, because some gems simply don't allow me to pass :message => "something describing the error", so I wanted to configure all the error messages through my YAML.
Also, with some models I'm able to translate their attributes, while with others I'm not. For example:
activerecord:
attributes:
additional_info:
account_manager: "Manager"
This works. I can see on my form "Manager". However, when this field has an error, Rails will display it as "Additional info account manager can't be blank".
I tried this:
activerecord:
errors:
models:
additional_info:
attributes:
account_manager: "Manager"
But no luck.
I did read the docs, but no clue on why it's happening.