Sha256: 03fdf090d0a5b61ac1cec9c1665ec08a44871ed410daba668562c24e217fcf7a
Contents?: true
Size: 658 Bytes
Versions: 3
Compression:
Stored size: 658 Bytes
Contents
module Attachs module Extensions module ActiveRecord module Validations extend ActiveSupport::Concern class AttachmentPresenceValidator < AttachmentValidator def validate_one(record, attribute, attachment) unless attachment.blank? record.errors.add attribute, :invalid attachment.errors.add :base, :blank end end end module ClassMethods def validates_attachment_presence_of(*attr_names) validates_with AttachmentPresenceValidator, _merge_attributes(attr_names) end end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems