Skip to content

Commit

Permalink
removed redefine load_async warning
Browse files Browse the repository at this point in the history
  • Loading branch information
DarshanaVenkatesh committed Dec 13, 2024
1 parent eff554b commit 7857378
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/mongoid/contextual.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module Contextual

# The methods in the contexts themselves should all get delegated to,
# including destructive, modification, and optional methods.
def_delegators :context, *(Mongo.public_instance_methods(false) - [ :skip, :limit ])
def_delegators :context, *(Mongo.public_instance_methods(false) - [ :skip, :limit, :load_async ])

# This gets blank and empty included.
def_delegators :context, *Queryable.public_instance_methods(false)
Expand All @@ -47,7 +47,11 @@ def context
#
# @return [ Criteria ] Returns self.
def load_async
context.load_async if context.respond_to?(:load_async)
if context.respond_to?(:load_async)
context.load_async
else
Mongo.instance_method(:load_async).bind(context).call
end
self
end

Expand Down

0 comments on commit 7857378

Please sign in to comment.