This has been undermining me for a while. This problem occurs with all my models, but I use one of them, Quiz, as an example.
Quiz has the following checks:
validates_presence_of :size, :style
I use I18n and I have the following set in my translation file: (these are only standard error messages, but I included them in my en.yml so that it is easy to see the structure if I want to override them for any specific model)
activerecord:
errors:
messages:
inclusion: "{{attribute}} is not included in the list"
invalid: "{{attribute}} is invalid"
empty: "{{attribute}} can't be empty"
blank: "{{attribute}} can't be blank"
record_invalid: "Validation failed: {{errors}}"
The problem is this: if I make a new quiz that fails the test, then look at quiz.errors.full_messages, each error message has an attribute, and then the full message:
>> quiz = Quiz.create
=> <unsaved quiz object>
>> quiz.errors.full_messages
=> ["Size Size can't be blank", "Style Style can't be blank"]
I do not understand why the message, for example "Size Size can't be blank", and not"Size can't be blank"
Any ideas anybody?