diff options
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/lib/active_model/errors.rb | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/activemodel/lib/active_model/errors.rb b/activemodel/lib/active_model/errors.rb index c2f0228785..f3ec406ec8 100644 --- a/activemodel/lib/active_model/errors.rb +++ b/activemodel/lib/active_model/errors.rb @@ -278,19 +278,18 @@ module ActiveModel # When using inheritance in your models, it will check all the inherited # models too, but only if the model itself hasn't been found. Say you have # <tt>class Admin < User; end</tt> and you wanted the translation for - # the <tt>:blank</tt> error +message+ for the <tt>title</tt> +attribute+, + # the <tt>:blank</tt> error message for the <tt>title</tt> attribute, # it looks for these translations: # - # <ol> - # <li><tt>activemodel.errors.models.admin.attributes.title.blank</tt></li> - # <li><tt>activemodel.errors.models.admin.blank</tt></li> - # <li><tt>activemodel.errors.models.user.attributes.title.blank</tt></li> - # <li><tt>activemodel.errors.models.user.blank</tt></li> - # <li>any default you provided through the +options+ hash (in the activemodel.errors scope)</li> - # <li><tt>activemodel.errors.messages.blank</tt></li> - # <li><tt>errors.attributes.title.blank</tt></li> - # <li><tt>errors.messages.blank</tt></li> - # </ol> + # * <tt>activemodel.errors.models.admin.attributes.title.blank</tt> + # * <tt>activemodel.errors.models.admin.blank</tt> + # * <tt>activemodel.errors.models.user.attributes.title.blank</tt> + # * <tt>activemodel.errors.models.user.blank</tt> + # * any default you provided through the +options+ hash (in the <tt>activemodel.errors</tt> scope) + # * <tt>activemodel.errors.messages.blank</tt> + # * <tt>errors.attributes.title.blank</tt> + # * <tt>errors.messages.blank</tt> + # def generate_message(attribute, type = :invalid, options = {}) type = options.delete(:message) if options[:message].is_a?(Symbol) |