Files
old-holivud2/app/validators/attached_validator.rb
2020-05-31 22:38:19 +02:00

6 lines
185 B
Ruby

class AttachedValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
record.errors.add(attribute, :attached, options) unless value.attached?
end
end