Class: Address

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/polymorphic/address.rb

Overview

Schema Information

Table name: addresses

id               :integer         not null, primary key
street1          :string(255)
street2          :string(255)
city             :string(64)
state            :string(64)
zipcode          :string(16)
country          :string(64)
full_address     :string(255)
address_type     :string(16)
addressable_id   :integer
addressable_type :string(255)
created_at       :datetime
updated_at       :datetime
deleted_at       :datetime

Instance Method Summary collapse

Instance Method Details

#blank?Boolean

Checks if the address is blank for both single and compound addresses.


Returns:

  • (Boolean)


49
50
51
52
53
54
55
# File 'app/models/polymorphic/address.rb', line 49

def blank?
  if Setting.compound_address
    %w(street1 street2 city state zipcode country).all? { |attr| self.send(attr).blank? }
  else
    self.full_address.blank?
  end
end