class Relationship < ActiveRecord::Base belongs_to :favourite_user, :class_name => "User", :foreign_key => "following_id" belongs_to :follower, :class_name => "User", :foreign_key => "user_id" end class User < ActiveRecord::Base has_many :relationships has_many :favourite_users, :through => :relationships has_many :followers, :through => :relationships end