Method: FileuidValidator#validate_each

Defined in:
app/validators/fileuid_validator.rb

#validate_each(record, attribute, value) ⇒ Object



2
3
4
5
6
7
8
9
# File 'app/validators/fileuid_validator.rb', line 2

def validate_each(record, attribute, value)
  return if options[:allow_nil] && value.presence.nil?
  if value.is_a?(EgovUtils::Fileuid)
    record.errors.add(attribute, (options[:message] || :fileuid_format)) if value.invalid?
  elsif !match_regexp?(record, attribute, value)
    record.errors.add(attribute, (options[:message] || :fileuid_format))
  end
end