-
Type: Task
-
Resolution: Done
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
includes(...) works great in most cases where you are using standard has_many and belongs_to. But we have a special referenced relationship that does not use this field and were wondering if it was possible to emulate something like includes using a different field.
We have something like:
#parents = Parent.all.includes(:children) parents = Parent.all parents.each do |p| p.children.each do |c| # N+1 query end end
Seems like there should be some hack here to get the children in there with one query. Thanks!