How do I select all child rows corresponding to a certain parent table using ActiveRecord queries.
create table foo (id, ...)
create table bar (id, foo_id, ...)
select * from foo where key = ?
# The above return a single row or multiple rows.
select * from bar where foo_id in <ids from the above output>
How do I achieve this?
Using only queries with
ActiveRecordUsing associations and eager loading :