Class: Rearview::Configuration::DirectoryValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/rearview/configuration.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/rearview/configuration.rb', line 24

def validate_each(record, attribute, value)
  passed = true
  if value.present?
    unless File.directory?(value)
      record.errors.add attribute, (options[:message] || "is not a directory")
      passed = false
    end
  end
end