Class: CarrierWave::Validations::ActiveModel::DownloadValidator

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) validate_each(record, attribute, value)



35
36
37
38
39
40
# File 'lib/carrierwave/validations/active_model.rb', line 35

def validate_each(record, attribute, value)
  if e = record.send("#{attribute}_download_error")
    message = (e.message == e.class.to_s) ? :carrierwave_download_error : e.message
    record.errors.add(attribute, message)
  end
end