app/models/customer_vault/person.rb in customer_vault-0.0.4 vs app/models/customer_vault/person.rb in customer_vault-1.0.0

- old
+ new

@@ -1,6 +1,17 @@ module CustomerVault class Person < ActiveRecord::Base - validates_presence_of :first_name - validates_presence_of :last_name + self.abstract_class = true + + def self.list + individuals = Individual.all + corporations = Corporation.all + return (individuals + corporations).sort_by(&:created_at) + 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