Files
manyfold/app/validators/existing_path_validator.rb
T

6 lines
194 B
Ruby

class ExistingPathValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
record.errors.add attribute, :not_found if value.nil? || !File.exist?(value)
end
end