Module | ArkanisDevelopment::SimpleLocalization::ExtendedErrorMessages::ErrorExtensions |
In: |
lib/features/extended_error_messages.rb
|
# File lib/features/extended_error_messages.rb, line 40 40: def self.included(base) 41: base.class_eval do 42: 43: alias_method :add_without_substitution, :add 44: 45: def add(attribute, msg = @@default_error_messages[:invalid]) 46: msg.send :extend, ArkanisDevelopment::SimpleLocalization::ExtendedErrorMessages::MessageExtension 47: msg.substitute! @base, attribute 48: add_without_substitution(attribute, msg) 49: end 50: 51: def full_messages 52: full_messages = [] 53: 54: @errors.each_key do |attr| 55: @errors[attr].each do |msg| 56: next if msg.nil? 57: 58: if attr == 'base' or not msg.prefix_with_attribute? 59: full_messages << msg 60: else 61: full_messages << @base.class.human_attribute_name(attr) + " " + msg 62: end 63: end 64: end 65: full_messages 66: end 67: 68: end 69: end
# File lib/features/extended_error_messages.rb, line 45 45: def add(attribute, msg = @@default_error_messages[:invalid]) 46: msg.send :extend, ArkanisDevelopment::SimpleLocalization::ExtendedErrorMessages::MessageExtension 47: msg.substitute! @base, attribute 48: add_without_substitution(attribute, msg) 49: end
# File lib/features/extended_error_messages.rb, line 51 51: def full_messages 52: full_messages = [] 53: 54: @errors.each_key do |attr| 55: @errors[attr].each do |msg| 56: next if msg.nil? 57: 58: if attr == 'base' or not msg.prefix_with_attribute? 59: full_messages << msg 60: else 61: full_messages << @base.class.human_attribute_name(attr) + " " + msg 62: end 63: end 64: end 65: full_messages 66: end