Class: ContentTypeValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- ContentTypeValidator
- Defined in:
- app/models/concerns/content_type_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
4 5 6 7 8 9 10 |
# File 'app/models/concerns/content_type_validator.rb', line 4 def validate_each(record, attribute, value) return unless value.attached? return if value.content_type.in?(content_types) value.purge record.errors.add(attribute, :content_type, ) end |