Class: ContactMethodValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
app/validators/contact_method_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



2
3
4
5
6
# File 'app/validators/contact_method_validator.rb', line 2

def validate(record)
  unless (!record.addresses.empty? or !record.phones.empty? or !record.emails.empty? or !record.urls.empty?)
    record.errors[:base] << "This contact doesn't have any methods of contacting them: like email or phone"
  end  
end