Class: Dragonfly::ActiveModelExtensions::Validations::PropertyValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/dragonfly/active_model_extensions/validations.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(model, attribute, attachment) ⇒ Object


7
8
9
10
11
12
# File 'lib/dragonfly/active_model_extensions/validations.rb', line 7

def validate_each(model, attribute, attachment)
  if attachment
    property = attachment.send(property_name)
    model.errors.add(attribute, message(property, model)) unless matches?(property)
  end
end