So I know how to find all parent records that don't have a child record.
Parent.joins(:child).where(child: {id: nil})
However how do I find all parent records with no children created in the last 30 days. I tried the following and it didn't work
Parent.joins(:child).where(child: {id: nil, created_at: 30.days.ago...Time.current})
Parent.joins(:child).where(child: {created_at: 30.days.ago...Time.current).where(child: {id: nil})
Neither of them worked. Any ideas?