Class: Attachs::Extensions::ActiveRecord::Validations::AttachmentValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- Attachs::Extensions::ActiveRecord::Validations::AttachmentValidator
- Defined in:
- lib/attachs/extensions/active_record/validations/attachment_validator.rb
Direct Known Subclasses
AttachmentContentTypeValidator, AttachmentPresenceValidator, AttachmentSizeValidator
Instance Method Summary collapse
Instance Method Details
#validate_each(record, record_attribute, attachment_or_collection) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/attachs/extensions/active_record/validations/attachment_validator.rb', line 9 def validate_each(record, record_attribute, ) case when Collection .each do || record, if .errors.any? record.errors.add record_attribute end end when Attachment record, if .errors.any? .errors.each do |, | record.errors.add record_attribute, end end end end |