2つのモデル(parent
とchild
)があり、親にhas_manyの子があり、親の配列があり、それらすべての親のすべての子を取得したい場合、SQLステートメントを手動で記述せずにRailsでこれを行う方法はありますか? ?
これが私がやりたいことです:
@parents = Parent.where("[various conditions]")
@children = @parents.children
2つのモデル(parent
とchild
)があり、親にhas_manyの子があり、親の配列があり、それらすべての親のすべての子を取得したい場合、SQLステートメントを手動で記述せずにRailsでこれを行う方法はありますか? ?
これが私がやりたいことです:
@parents = Parent.where("[various conditions]")
@children = @parents.children