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

- (Object) validate_each(model, attribute, attachment)



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