Displaying 2 results from an estimated 2 matches for "create_reverse_associ".
2006 Jan 09
6
has_and_belongs_to_many :self
Hi all
I got the following class:
class Member < ActiveRecord::Base
  has_and_belongs_to_many :buddies,
                          :class_name => ''Member'',
                          :join_table => ''members_have_buddies'',
                          :foreign_key => ''member_id'',
                          :association_foreign_key =>
2006 Feb 27
4
2 belongs_to to the same parent table
Hello!
I have 2 table: users and buddies
User: id, name, ...
Buddy: id, user_id, user_buddy_id, ...
So if you have 2 users 1,jack and 2,fred and fred is a buddy of jack, 
there is a Buddy object: id=1, user_id=1, user_buddy_id=2
I can declare only one belongs_to in Buddy and one has_many in User. And 
there is conflict if I had the second one (the first one is discarded)
class User
  has_many