Class: BillingAddressValidator

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

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



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

def validate(record)
  address = record.try(:billing_address)

  record.errors[:billing_address] << "valid billing address is required" unless (address.present? and address.valid?)
end