lib/mongoid/relations/targets/enumerable.rb in mongoid-5.0.2 vs lib/mongoid/relations/targets/enumerable.rb in mongoid-5.1.0
- old
+ new
@@ -239,11 +239,11 @@
if target.is_a?(Criteria)
@_added, @executed, @_loaded, @_unloaded = {}, false, {}, target
else
@_added, @executed = {}, true
@_loaded = target.inject({}) do |_target, doc|
- _target[doc._id] = doc
+ _target[doc._id] = doc if doc
_target
end
end
end
@@ -338,11 +338,11 @@
#
# @return [ Array<Object> ] The dumped data.
#
# @since 3.0.15
def marshal_dump
- [ _added, _loaded, _unloaded ]
+ [ _added, _loaded, _unloaded, @executed]
end
# Loads the data needed to Marshal.load an enumerable proxy.
#
# @example Load the proxy.
@@ -350,10 +350,10 @@
#
# @return [ Array<Object> ] The dumped data.
#
# @since 3.0.15
def marshal_load(data)
- @_added, @_loaded, @_unloaded = data
+ @_added, @_loaded, @_unloaded, @executed = data
end
# Reset the enumerable back to its persisted state.
#
# @example Reset the enumerable.