8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
# File 'lib/amistad/friend_model.rb', line 8
def acts_as_friend
has_many :friendships
has_many :pending_invited,
:through => :friendships,
:source => :friend,
:conditions => { :'friendships.pending' => true }
has_many :invited,
:through => :friendships,
:source => :friend,
:conditions => { :'friendships.pending' => false }
has_many :inverse_friendships, :class_name => "Friendship", :foreign_key => "friend_id"
has_many :pending_invited_by,
:through => :inverse_friendships,
:source => :user,
:conditions => {:'friendships.pending' => true}
has_many :invited_by,
:through => :inverse_friendships,
:source => :user,
:conditions => {:'friendships.pending' => false}
class_eval <<-EOV
include Amistad::FriendModel::InstanceMethods
EOV
end
|