Module: NoBrainer::Document::References::AssociationExt

Extended by:
AssociationExt
Included in:
AssociationExt
Defined in:
lib/no_brainer/references/eager_loader.rb

Instance Method Summary collapse

Instance Method Details

#eager_load_association(docs, association_name, criteria = nil) ⇒ Object



42
43
44
45
46
47
48
# File 'lib/no_brainer/references/eager_loader.rb', line 42

def eager_load_association(docs, association_name, criteria=nil)
  if (field = docs&.first) && (field = field.root_class.fields[association_name.to_sym]) && field_is_reference_type?(field)
    NoBrainer::Document::References.eager_load(docs, association_name, field, criteria)
  else
    super
  end
end