I have 3 tables: User, Event and Order.
Each user can create new event and multiple users can make an order to an event.
So user will have two roles, event creator and orderer. I will focus on orderer.
For example, there are:
Event1 [ order1, order2, order3 ]
Event2 [ order4, order5, order6 ]
Event3 [ order7, order8, order9 ]
UserA is the orderer of [ order1,order4,order7 ]
UserB is the orderer of [ order3, order 5 ]
What I want to try is get all Events relation with orders where userB involved.
My expected result is ( Event1 and Event2 ) since UserB’s orders are [ order3 and 5 ]
I tried with scopes but not the one I want.
Please shed me a light kindly.
Thanks in advance!