User Model


			
has_many :discoverers,  :foreign_key => 'follower_id', 
                          :class_name => 'Friendship', 
                          :dependent => :destroy
has_many :followees,    :through => :discoverers
has_many :listeners,    :foreign_key => 'followee_id', 
                          :class_name => 'Friendship', 
                          :dependent => :destroy
has_many :followers,    :through => :listeners

has_many :discoveries

Friendship Model


			
belongs_to :follower, :class_name => "User"
belongs_to :followee, :class_name => "User"
validates_uniqueness_of :follower_id, :scope => :followee_id

Discovery Model


			
belongs_to :user

Discoveries Controller


			
def index
    @discoveries = current_user.discoverer.discoveries.find(:all)
end