1
0
mirror of https://github.com/danbee/my-images synced 2025-03-04 08:49:05 +00:00
my-images/app/validators/attached_validator.rb

8 lines
196 B
Ruby

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