Class: Progstr::Filer::Validation::AttachmentPropertyValidator
- Inherits:
-
ActiveModel::Validations::InclusionValidator
- Object
- ActiveModel::Validations::InclusionValidator
- Progstr::Filer::Validation::AttachmentPropertyValidator
- Defined in:
- lib/filer/validation.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ AttachmentPropertyValidator
constructor
A new instance of AttachmentPropertyValidator.
- #validate_each(record, attribute, attachment) ⇒ Object
Constructor Details
#initialize(options) ⇒ AttachmentPropertyValidator
Returns a new instance of AttachmentPropertyValidator.
39 40 41 42 |
# File 'lib/filer/validation.rb', line 39 def initialize() @property = [:property] super() end |
Instance Method Details
#validate_each(record, attribute, attachment) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/filer/validation.rb', line 44 def validate_each(record, attribute, ) unless .pre_validated property_value = .send(@property) super(record, attribute, property_value) unless .nil? || .blank? || property_value.nil? end end |