app/models/customer_vault/person.rb in customer_vault-1.2.7 vs app/models/customer_vault/person.rb in customer_vault-1.2.8
- old
+ new
@@ -1,16 +1,16 @@
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
+ acts_as_taggable
+
+ has_many :comments, -> { order("id DESC") }, class_name: "Dorsale::Comment", as: :commentable
+ has_one :address, class_name: 'Dorsale::Address', as: :addressable, inverse_of: :addressable
accepts_nested_attributes_for :address, allow_destroy: true
def self.list
- individuals = Individual.all
- corporations = Corporation.all
- return (individuals + corporations)
+ 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}}