I want to find all Users that bought their car before they were 18.
I need a query like this:
User.includes(:car) .where(car: { bought_at < (user.birthday + 18.years)})
How can I write such an query in Rails 5 with Postgresql? Thank you
Aucun commentaire:
Enregistrer un commentaire