Commit 67d72e2173b41a48fc01fccf20044e577b261804

Authored by MoisesMachado
1 parent 5124f3d7

ActionItem6: affiliation relation for person model fixed

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@211 3f533792-8f58-4932-b0fe-aaf55b0a4547
Showing 1 changed file with 8 additions and 3 deletions   Show diff stats
app/models/person.rb
1 1 class Person < Profile
2 2 belongs_to :user
3   - has_many :affiliations
4   - has_many :related_profiles, :class_name => 'Profile', :through => :affiliations
5   - has_many :friends, :class_name => 'Person'
  3 + has_many :personal_affiliations, :class_name => 'Affiliation'
  4 + has_many :related_profiles, :class_name => 'Profile', :through => :personal_affiliations, :source => 'profile'
  5 +
  6 + has_many :friendships
  7 + has_many :friends, :class_name => 'Person', :through => :friendships
  8 +
  9 + has_many :other_friendships
  10 + has_many :other_friend, :class_name => 'Person', :through => :other_friendships, :foreign_key => 'friend_id'
6 11  
7 12 def my_enterprises
8 13 related_profiles.select{ |p| p.kind_of?(Enterprise) }
... ...