module Related::Follower
Public Instance Methods
follow!(other)
click to toggle source
# File lib/related/follower.rb, line 3 def follow!(other) Related::Relationship.create(:follow, self, other) end
followed_by?(other)
click to toggle source
# File lib/related/follower.rb, line 24 def followed_by?(other) self.followers.include?(other) end
followers()
click to toggle source
# File lib/related/follower.rb, line 12 def followers self.incoming(:follow) end
followers_count()
click to toggle source
# File lib/related/follower.rb, line 32 def followers_count self.followers.size end
following()
click to toggle source
# File lib/related/follower.rb, line 16 def following self.outgoing(:follow) end
following?(other)
click to toggle source
# File lib/related/follower.rb, line 28 def following?(other) self.following.include?(other) end
following_count()
click to toggle source
# File lib/related/follower.rb, line 36 def following_count self.following.size end
friends()
click to toggle source
# File lib/related/follower.rb, line 20 def friends self.followers.intersect(self.following) end
unfollow!(other)
click to toggle source
# File lib/related/follower.rb, line 7 def unfollow!(other) rel = self.following.relationships.find(other) rel.destroy if rel end