Displaying 1 result from an estimated 1 matches for "close_friend".
Did you mean:
close_friends
2006 Mar 25
0
Self-Referential Many-To-Many relationships where the relationship itself has data.
...l code:
class User < ActiveRecord::Base
has_and_belongs_to_many :all_friends,
:class_name => "User",
:join_table => "friendships",
:foreign_key => "user_id",
:association_foreign_key => "friend_id"
has_and_belongs_to_many :close_friends,
:class_name => "User",
:join_table => "friendships",
:foreign_key => "user_id",
:association_foreign_key => "friend_id",
:conditions => "rating > 1"
end
class Friendship < ActiveRecord::Base
belongs_to :...