I have a user model that has an associated cart. Each cart has a purchased_at datetime column.
I want to select all users that have have not purchased a cart in the last 3 months.
I though a simple:
User.joins(:carts).where('not carts.purchased_at < ?', 3.months.ago)
would do the trick but this doesn’t seem to be the case. I’m being returned user records who have purchased something in the past 3 months.
Any thoughts?
You should be able to do this is in plain active record: