Open onnimonni opened 6 years ago
You definitely don't want to use eager_load
with all_json
. all_json
uses the SQL from the base query and that will include the renamed fields that ActiveRecord uses for eager loading. To include additional nested objects you should use the include
option for all_json
.
As far as your original query, the intention is unclear to me. I think ActiveRecord would treat it as load all people that are part of organization 'XXX'. It would also partially load the group and organization associations due to the where clause. I'd recommend using an explicit join instead of eager load if possible. That would probably work with Surus.
If I use eager_load for 3 different objects
Person
,Group
,Organization
like this:The end result will have all of it's fields renamed to t0_r0 ... t2_r12.