Sha256: cf1ac14793c5d30977aeab49b2b96ca26f1936a76ec85cd4db4e13054245a164
Contents?: true
Size: 422 Bytes
Versions: 28
Compression:
Stored size: 422 Bytes
Contents
module Mongoid class Criteria def find_ordered(*ids) ids = Array(ids).flatten return [] if ids.blank? lookup = scoped.any_in(id: ids).to_lookup_hash ids.map { |id| lookup[id] }.compact end end end module Mongoid module FindOrdered def find_ordered(*args) criteria.find_ordered(*args) end end end Mongoid::Document::ClassMethods.send(:include, Mongoid::FindOrdered)
Version data entries
28 entries across 28 versions & 1 rubygems