You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current behavior of has_many through assume than the passthrough model table has two foreign keys bundled into the table.
However, in some case we want to call has_many through while the passed-through table has only one foreign key (or even non!).
An example would be this one:
class A
include Clear::Model
belongs_to b : B
has_many c : C, through: B # << Error because B doesn't have the foreign key for A and C
end
class B
include Clear::Model
has_many a : A
has_many c : C
end
class C
include Clear::Model
belongs_to b : B
end
This fix won't be trivial and must be done before we go to polymorphic associations.
The text was updated successfully, but these errors were encountered:
I think the rails way of viewing has_many: :through is it covers any situation where there is some model A, some intermediate model, B, and some model C, where B has either a has_many, has_one, or belongs_to association with C, and A has either a has_many, has_one, or belongs_to association with B, and rails will do whatever joins are necessary to find all the rows of C that are indirectly associated with A. So something like 9 4 different join situations I think potentially. Would <3 <3 <3 if this was fully supported.
I think the most common situation in the wild is not the one that is currently supported but rather Ahas_manyB which has_manyC, which my snippet above supports.
Current behavior of
has_many through
assume than the passthrough model table has two foreign keys bundled into the table.However, in some case we want to call has_many through while the passed-through table has only one foreign key (or even non!).
An example would be this one:
This fix won't be trivial and must be done before we go to polymorphic associations.
The text was updated successfully, but these errors were encountered: