Class: ExistingPathValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
app/validators/existing_path_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



2
3
4
5
# File 'app/validators/existing_path_validator.rb', line 2

def validate_each(record, attribute, value)
  # i18n-tasks-use t("activerecord.errors.models.library.attributes.path.not_found")
  record.errors.add attribute, :not_found if value.nil? || !File.exist?(value)
end