Skip to content

Commit

Permalink
rm eager_load
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurnn committed Oct 6, 2013
1 parent d32d61b commit d21f279
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 42 deletions.
14 changes: 0 additions & 14 deletions lib/mongoid/relations/metadata.rb
Original file line number Diff line number Diff line change
Expand Up @@ -229,20 +229,6 @@ def dependent?
!!dependent
end

# Get the criteria needed to eager load this relation.
#
# @example Get the eager loading criteria.
# metadata.eager_load(criteria)
#
# @param [ Array<Object> ] ids The ids of the returned parents.
#
# @return [ Criteria ] The eager loading criteria.
#
# @since 2.2.0
def eager_load(ids)
relation.eager_load(self, ids)
end

# Will determine if the relation is an embedded one or not. Currently
# only checks against embeds one and many.
#
Expand Down
28 changes: 0 additions & 28 deletions lib/mongoid/relations/proxy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,34 +236,6 @@ class << self
def apply_ordering(criteria, metadata)
metadata.order ? criteria.order_by(metadata.order) : criteria
end

# Get the criteria that is used to eager load a relation of this
# type.
#
# @example Get the eager load criteria.
# Proxy.eager_load(metadata, criteria)
#
# @param [ Metadata ] metadata The relation metadata.
# @param [ Array<Object> ] ids The ids of the base docs.
#
# @return [ Criteria ] The criteria to eager load the relation.
#
# @since 2.2.0
def eager_load_ids(metadata, ids)
klass, foreign_key = metadata.klass, metadata.foreign_key
eager_loaded = klass.any_in(foreign_key => ids).entries
ids.each do |id|
sel = { foreign_key => id }
sel.merge!(metadata.type_relation) if klass.hereditary?
IdentityMap.clear_many(klass, sel)
end
eager_loaded.each do |doc|
base_id = doc.__send__(foreign_key)
sel = { foreign_key => base_id }
sel.merge!(metadata.type_relation) if klass.hereditary?
yield(doc, sel)
end
end
end
end
end
Expand Down

0 comments on commit d21f279

Please sign in to comment.