Sha256: 55adf2b6836d0b79f10ba07ebb8b3142edf8d4877f0e2a1e950c4049a4a4b5d8

Contents?: true

Size: 324 Bytes

Versions: 6

Compression:

Stored size: 324 Bytes

Contents

class RecipientsPresenceValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    recipients = record.send(attribute)
   
    record.errors.add :recipients, (options[:message] || I18n.t('activerecord.errors.models.carrier/message.attributes.recipients.empty')) if recipients.empty?

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
carrier-0.1.5 app/validators/recipients/recipients_presence_validator.rb
carrier-0.1.4 app/validators/recipients/recipients_presence_validator.rb
carrier-0.1.3 app/validators/recipients/recipients_presence_validator.rb
carrier-0.1.2 app/validators/recipients/recipients_presence_validator.rb
carrier-0.1.1 app/validators/recipients/recipients_presence_validator.rb
carrier-0.1.0 app/validators/recipients/recipients_presence_validator.rb