Class: CarrierWave::Validations::ActiveModel::IntegrityValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/carrierwave/validations/active_model.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



22
23
24
25
26
# File 'lib/carrierwave/validations/active_model.rb', line 22

def validate_each(record, attribute, value)
  record.__send__("#{attribute}_integrity_errors").each do |e|
    record.errors.add(attribute, :carrierwave_integrity_error, message: (e.message != e.class.to_s) && e.message)
  end
end