In my rails app, collections have many projects, and projects have many steps.
I\'d like to grab all the ids of steps
Unfortunately, I don't think that we could do it through AR in a single query. You could do a nested query below to retrieve it in two queries to the database:
Step.includes(:projects)
.where(projects: { id: Projects.includes(:collections)
.where(collections: { id: @collections.id }).pluck(:id) } )
.pluck(:id)