From 67d72e2173b41a48fc01fccf20044e577b261804 Mon Sep 17 00:00:00 2001 From: MoisesMachado Date: Mon, 30 Jul 2007 18:22:39 +0000 Subject: [PATCH] ActionItem6: affiliation relation for person model fixed --- app/models/person.rb | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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