Module: CarrierWave::Validations::ActiveModel::HelperMethods

Defined in:
lib/carrierwave/validations/active_model.rb

Instance Method Summary collapse

Instance Method Details

#validates_download_of(*attr_names) ⇒ Object

Makes the record invalid if the remote file couldn’t be downloaded

Accepts the usual parameters for validations in Rails (:if, :unless, etc…)



67
68
69
# File 'lib/carrierwave/validations/active_model.rb', line 67

def validates_download_of(*attr_names)
  validates_with DownloadValidator, _merge_attributes(attr_names)
end

#validates_integrity_of(*attr_names) ⇒ Object

Makes the record invalid if the file couldn’t be uploaded due to an integrity error

Accepts the usual parameters for validations in Rails (:if, :unless, etc…)



48
49
50
# File 'lib/carrierwave/validations/active_model.rb', line 48

def validates_integrity_of(*attr_names)
  validates_with IntegrityValidator, _merge_attributes(attr_names)
end

#validates_processing_of(*attr_names) ⇒ Object

Makes the record invalid if the file couldn’t be processed (assuming the process failed with a CarrierWave::ProcessingError)

Accepts the usual parameters for validations in Rails (:if, :unless, etc…)



58
59
60
# File 'lib/carrierwave/validations/active_model.rb', line 58

def validates_processing_of(*attr_names)
  validates_with ProcessingValidator, _merge_attributes(attr_names)
end