Sha256: 87c0a16249434bab8ef5bc96455ff50f687aa7c5921915bc9ceef8310f20a03b

Contents?: true

Size: 727 Bytes

Versions: 5

Compression:

Stored size: 727 Bytes

Contents

module CustomerVault
  class Person < ActiveRecord::Base
    self.abstract_class = true
    
    has_many :comments, class_name: "Dorsale::Comment", as: :commentable
    has_one :address, class_name: 'Dorsale::Address', as: :addressable
    accepts_nested_attributes_for :address, allow_destroy: true

    def self.list 
      individuals = Individual.all
      corporations = Corporation.all
      return (individuals + corporations)
    end

    def links
      a = Link.where(alice_id: self.id, alice_type: self.class).map {|l| {title: l.title, person: l.bob, origin: l}}
      b = Link.where(bob_id: self.id, bob_type: self.class).map {|l| {title: l.title, person: l.alice, origin: l}}
      return a + b
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
customer_vault-1.2.5 app/models/customer_vault/person.rb
customer_vault-1.2.4 app/models/customer_vault/person.rb
customer_vault-1.2.3 app/models/customer_vault/person.rb
customer_vault-1.2.2 app/models/customer_vault/person.rb
customer_vault-1.2.1 app/models/customer_vault/person.rb