6 lines
185 B
Ruby
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
|