global
def load_children(keys, lock: nil)
def load_children(keys, lock: nil) scope = child_constraints.inject(child_type.unscoped) do |sc, (col, val)| sc.where(col => val) end if lock scope = scope.order(:id).lock(lock) end scope.where(child_key_column => keys).group_by { |c| c.read_attribute(child_key_column) } end