'rails get record that is not exist on right join
I am trying to get a query for a join table, where the record in right table is nonexistent, for a specific param.
Let say that a user should post email every day, and the email model will be created with a date. I want to get users who did not post an email on a specific day.
I tried using not exist and also not in but to no avail. Or maybe my syntax is incorrect or I am missing something.
User.joins(:emails).where("emails.date not in ('2021-01-24') and emails.id is null)
Is this possible?
Thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
