class ActiveModel::Errors
def generate_message(attribute, type = :invalid, options = {})
* errors.attributes.title.blank
* activemodel.errors.messages.blank
* any default you provided through the +options+ hash (in the activemodel.errors scope)
* activemodel.errors.models.user.blank
* activemodel.errors.models.user.attributes.title.blank
* activemodel.errors.models.admin.blank
* activemodel.errors.models.admin.attributes.title.blank
it looks for these translations:
the :blank error message for the title attribute,
class Admin < User; end and you wanted the translation for
models too, but only if the model itself hasn't been found. Say you have
When using inheritance in your models, it will check all the inherited
interpolation.
name, translated attribute name, and the value are available for
(e.g. activemodel.errors.messages.MESSAGE). The translated model
that is not there also, it returns the translation of the default message
if it's not there, it's looked up in activemodel.errors.models.MODEL.MESSAGE and if
Error messages are first looked up in activemodel.errors.models.MODEL.attributes.ATTRIBUTE.MESSAGE,
(activemodel.errors.messages).
Translates an error message in its default scope
def generate_message(attribute, type = :invalid, options = {}) Error.generate_message(attribute, type, @base, options) end