Displaying 1 result from an estimated 1 matches for "crates_cr".
2007 Nov 13
4
has_and_belongs_to_many between the same model
...e two models: Jewel and Crate. A crate can contain other crates
and it can also contain as many jewels as we want. So, in jewel.rb i
put:
[code]
belongs_to :crate
[/code]
and in crate.rb:
[code]
has_many :jewels
has_and_belongs_to_many :crates
[/code]
Now i have to create the join table "crates_crates" but i really have no
idea on how to specify the first index is the father-crade index while
the second is the child-crade index. Btw, my "crades" table has a
"crade_id" column, is this right, or should i remove it since i use a
join table?
Thanks!
--
Posted via http:...