31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/obscurify_attribute/validations.rb', line 31
def errors_with_obscured
errors_without_obscured.tap do |result|
if !self.class.sensitive_attrs.empty? && !(result.keys & self.class.sensitive_attrs.keys).empty?
self.class.sensitive_attrs.each do |old_name, options|
new_name = options[:to]
messages = options.has_key?(:message) ? Array.wrap(options[:message]) : result[old_name]
messages.each { |error| result.add(new_name, error) }
result[old_name].clear
result[new_name].uniq!
end
end
end
end
|