Can someone please confirm or correct the following statements?
If I have the following tables
create table as (id int, […], b_id int);
create table bs (id int, […], a_id int);
create table as_bs (a_id int, b_id int);
and the associations woould be defined like this
class A << …
habtm :bs
belongs_to :b
end
so my Model A has a habtm collection of Bs plus a direct belongs_to
link to one B (and vice versa).
So
a = A.find(:first)
b = a.bs.first
a2 = b.a
might not give me back a, because b’s direct belongs_to a reference is
clobbered with the reference from the join table a_b (because the
foreign keys have the same name)?
Or does this only apply to non foreign key attributes?
There are no such problems if I’d make a_b a join model and have no
habtm, but a has_many :through instead?
What other options to circumvent this problem do I have (besides
renaming the foreign keys either in the model or join tables)?
TIA! - Bernd