Sha256: 3740601319b5c9d5e6f8bdba594c237aa3ff987ba691336d71ff422d2a498ae9
Contents?: true
Size: 348 Bytes
Versions: 78
Compression:
Stored size: 348 Bytes
Contents
class AssetBoxPresenceValidator < ActiveModel::EachValidator def validate_each(record, attribute, value) num_in_box = (record.attachments || []).select { |attachment| attachment.box == attribute.to_s.pluralize && attachment.marked_for_destruction? == false }.size record.errors[attribute] << "can't be blank" if num_in_box == 0 end end
Version data entries
78 entries across 78 versions & 1 rubygems