Sha256: 95e2fbdbae634bf3a8fa44d7b206ea0be54060dacc7f33b59060f4952404af5b
Contents?: true
Size: 882 Bytes
Versions: 2
Compression:
Stored size: 882 Bytes
Contents
module CustomerVault class Person < ActiveRecord::Base self.abstract_class = true include Dorsale::PolymorphicId acts_as_taggable def tags_on(*args) super(*args).order(:name) end has_many :comments, -> { order("id DESC") }, class_name: "Dorsale::Comment", as: :commentable has_one :address, class_name: 'Dorsale::Address', as: :addressable, inverse_of: :addressable has_many :tasks, class_name: "Flyboy::Task", as: :taskable accepts_nested_attributes_for :address, allow_destroy: true def self.list Individual.all + Corporation.all 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
customer_vault-1.3.1 | app/models/customer_vault/person.rb |
customer_vault-1.3.0 | app/models/customer_vault/person.rb |