Displaying 1 result from an estimated 1 matches for "bosses_courses".
2007 Jul 26
1
Bi-directional self-referential HABTM
...guring out how to make a self-
referential HABTM bi-directional.
I have a Employee class. Each employee can have a couple of bosses,
who are also employees. The employee class has the following HABTM:
has_and_belongs_to_many :bosses, :class_name =>
"Employee", :join_table => "bosses_courses", :association_foreign_key
=> "boss_id", :foreign_key => "employee_id"
Now this works fine.. but only one way. I can get all bosses of an
employee but I can''t get all employees of a boss.
In hindsight I think it probaby would have been better to use
a :thro...