11
12
13
14
15
16
17
18
19
20
|
# File 'lib/circle/circle.rb', line 11
def has_circle
include Circle::InstanceMethods
has_many :friendships, class_name: "Circle::Friendship"
has_many :friends, through: :friendships, source: :friend, conditions: "friendships.status = 'accepted'"
has_many :friendship_requests, class_name: "Circle::Friendship", foreign_key: :friend_id, conditions: "friendships.status = 'requested'"
has_many :users_blocked, class_name: "Circle::BlockedUser"
has_many :blocked_users, through: :users_blocked, source: :blocked_user
after_destroy :destroy_all_friendships
end
|