class Refinery::Jobs::Validators::FileSizeValidator

Public Instance Methods

validate(record) click to toggle source
# File lib/refinery/jobs/validators/file_size_validator.rb, line 6
def validate(record)
  file = record.resume

  if file.respond_to?(:length) && file.length > Refinery::Resources.max_file_size
    record.errors[:file] << ::I18n.t('too_big',
                                     :scope => 'activerecord.errors.models.refinery/resource',
                                     :size => Refinery::Resources.max_file_size)
  end
end