Module: Has::Followers::ClassMethods

Defined in:
lib/has_followers/has_followers.rb

Instance Method Summary collapse

Instance Method Details

#has_followersObject



8
9
10
11
12
13
14
15
# File 'lib/has_followers/has_followers.rb', line 8

def has_followers
  include Has::Followers::InstanceMethods
  
  has_many :followed_to, :class_name => 'Follow', :foreign_key => 'user_id'
  has_many :follower_to, :class_name => 'Follow', :foreign_key => 'followed_id'
  has_many :followeds, :through => :followed_to, :source => :followed
  has_many :followers, :through => :follower_to, :source => :follower
end