Maintenance
HABTM MaintenanceOrders
Given an array of MaintenanceOrder
ids: [1,2,3,4,5]
, how can I retrieve all the Maintenances
associated with those MaintenanceOrders
?
Tried this:
@paired_things = Maintenance.where(maintenance_order_id: [1,2,3,4,5])
But it rightly failed because maintenance_order_id
isn't a column on Maintenance, and of course that doesn't make sense because it's a HABTM relationship...
This is the join table from schema:
create_table "maintenance_orders_maintenances", id: false, force: true do |t|
t.integer "maintenance_order_id"
t.integer "maintenance_id"
end