Module: Mongoload::MongoContextWithAutoInclude
- Defined in:
- lib/mongoload/patches/mongoid_contextual_mongo_patch.rb
Instance Method Summary collapse
Instance Method Details
#documents_for_iteration ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/mongoload/patches/mongoid_contextual_mongo_patch.rb', line 4 def documents_for_iteration results = super if results.is_a?(Mongo::Collection::View) require 'byebug' begin results.to_a rescue SystemStackError byebug end results = results.map { |doc| Mongoid::Factory.from_db(klass, doc, criteria.[:fields]) } end results.tap do |documents| Mongoload::AutoIncludeContext.register_docs(documents.to_a) end end |