diff --git a/app/models/person.rb b/app/models/person.rb index 5fca50e..ab05ec6 100644 --- a/app/models/person.rb +++ b/app/models/person.rb @@ -1,8 +1,13 @@ class Person < Profile belongs_to :user - has_many :affiliations - has_many :related_profiles, :class_name => 'Profile', :through => :affiliations - has_many :friends, :class_name => 'Person' + has_many :personal_affiliations, :class_name => 'Affiliation' + has_many :related_profiles, :class_name => 'Profile', :through => :personal_affiliations, :source => 'profile' + + has_many :friendships + has_many :friends, :class_name => 'Person', :through => :friendships + + has_many :other_friendships + has_many :other_friend, :class_name => 'Person', :through => :other_friendships, :foreign_key => 'friend_id' def my_enterprises related_profiles.select{ |p| p.kind_of?(Enterprise) } -- libgit2 0.21.2