You need to use techniques such as references
, joins
, includes
or eager_load
, depending on what you need. The easiest way to determine what to choose is to go to the documentation / api and read them.
, order_reminders
Order
, joins
, INNER JOIN
, orders
order_reminders
, , , , -.
Order.joins(:order_reminders).where('order_reminders.date < ?', 1.month.from_now)