module CustomerVault class Person < ActiveRecord::Base self.abstract_class = true 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