Re: many_to_many with multiple right_key / right_primary_key values combined with OR instead of AND

2022-07-06 Thread Matt Culpepper
Got it. Thank you! > On Jul 6, 2022, at 2:49 PM, Jeremy Evans wrote: > >  >> On Wed, Jul 6, 2022 at 12:24 PM Matt Culpepper wrote: > >> Thanks, that mostly works, except it drops the `WHERE (("table2"."user_id" = >> )` >> >> I can add a .where(user_id: ...) but I'm not sure how to specify t

Re: many_to_many with multiple right_key / right_primary_key values combined with OR instead of AND

2022-07-06 Thread Jeremy Evans
On Wed, Jul 6, 2022 at 12:24 PM Matt Culpepper wrote: > Thanks, that mostly works, except it drops the `WHERE (("table2"."user_id" > = )` > > I can add a .where(user_id: ...) but I'm not sure how to specify that I > want the actual id of the user in this context > > Sorry if the answer is obvious

Re: many_to_many with multiple right_key / right_primary_key values combined with OR instead of AND

2022-07-06 Thread Matt Culpepper
Thanks, that mostly works, except it drops the `WHERE (("table2"."user_id" = )` I can add a .where(user_id: ...) but I'm not sure how to specify that I want the actual id of the user in this context Sorry if the answer is obvious! On Wednesday, July 6, 2022 at 12:56:13 PM UTC-5 Jeremy Evans wr

Re: many_to_many with multiple right_key / right_primary_key values combined with OR instead of AND

2022-07-06 Thread Jeremy Evans
On Wed, Jul 6, 2022 at 10:38 AM Matt Culpepper wrote: > Hey Jeremy, I'm trying to set up a relationship in a model that generates > SQL like the following join with an OR between the conditions. > > SELECT * FROM table1 INNER JOIN table2 ON (("table2"."resource_id" = > "table1"."an_id") OR ("tabl

many_to_many with multiple right_key / right_primary_key values combined with OR instead of AND

2022-07-06 Thread Matt Culpepper
Hey Jeremy, I'm trying to set up a relationship in a model that generates SQL like the following join with an OR between the conditions. SELECT * FROM table1 INNER JOIN table2 ON (("table2"."resource_id" = "table1"."an_id") OR ("table2"."resource_id" = "table1"."another_id")) WHERE (("table2"."