Class: Refinery::Images::Validators::ImageSizeValidator
- Inherits:
-
ActiveModel::Validator
- Object
- ActiveModel::Validator
- Refinery::Images::Validators::ImageSizeValidator
- Defined in:
- lib/refinery/images/validators/image_size_validator.rb
Instance Method Summary collapse
Instance Method Details
#validate(record) ⇒ Object
6 7 8 9 10 11 12 13 14 |
# File 'lib/refinery/images/validators/image_size_validator.rb', line 6 def validate(record) image = record.image if image.respond_to?(:length) && image.length > Images.max_image_size record.errors[:image] << ::I18n.t('too_big', :scope => 'activerecord.errors.models.refinery/image', :size => Images.max_image_size) end end |