mirror of
https://github.com/danbee/my-images
synced 2025-03-04 08:49:05 +00:00
8 lines
196 B
Ruby
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
|