Displaying 1 result from an estimated 1 matches for "potential_friendships".
2006 May 28
7
Self-referential has_many :through relationship
...t; ''friend_id''
end
class User < ActiveRecord::Base
has_many :relationships
has_many :friendships, :class_name => ''Relationship'', :foreign_key
=> ''user_id'', :conditions => "relation = ''f''"
has_many :potential_friendships, :class_name => ''Relationship'',
:foreign_key => ''user_id'', :conditions => "relation = ''r''"
has_many :friends, :through => :friendships
has_many :potential_friends, :through => :potential_friendships
end
Everything...