Module: ProfileableMixins::Address::ClassMethods

Defined in:
app/models/profileable_mixins/address.rb

Instance Method Summary collapse

Instance Method Details

#with_postal_addressObject



105
106
107
# File 'app/models/profileable_mixins/address.rb', line 105

def with_postal_address
  self.joins(:address_profile_fields).where('profile_fields.profileable_id IS NOT NULL AND profile_fields.value != ""').uniq
end

#with_postal_address_idsObject



109
110
111
# File 'app/models/profileable_mixins/address.rb', line 109

def with_postal_address_ids
  self.with_postal_address.pluck(:id)
end

#without_postal_addressObject



113
114
115
# File 'app/models/profileable_mixins/address.rb', line 113

def without_postal_address
  self.where('NOT users.id IN (?)', self.with_postal_address_ids)
end