In my rails app, collections have many projects, and projects have many steps.
I'd like to grab all the ids of steps in a collection's projects, and I'm wondering if I can do it all in one query.
For example, I know I can do the following
step_ids = []
@collection.projects.each do |project|
project.steps.each do |step|
step_ids << step.id
end
end
But is it possible to do something like the following:
@collection.projects.include(:steps).pluck("step.id")
// syntax here is not correct