devondahon's avatar

Link two models from two in between models

With the following structure :

        ____cars____
foos___/            \___bars
       \___trucks___/

What should I add to my Foo model to the corresponding bar ? Knowing that both foos and bars contain car_id and truck_id.

0 likes
3 replies
devondahon's avatar

@nakov It's not exactly the situation. One foo can have one bar only through their car_id and truck_id. I don't know if there's a name for such model.

PovilasKorop's avatar

@devondahon from example of foo and bar it's very hard to understand what is the actual relationship and what do they MEAN.

What would the typical queries look like? I mean, on a specification level, not the code. Then it may become clearer.

Also, there's a possibility that you can't describe some things in the relationships directly, only get the data with queries/collections.

Please or to participate in this conversation.