Module: Mongoid::Extensions::Hash::CriteriaHelpers

Defined in:
lib/mongoid_spacial/extentions/hash/criteria_helpers.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#expand_complex_criteriaObject



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/mongoid_spacial/extentions/hash/criteria_helpers.rb', line 6

def expand_complex_criteria
  hsh = {} 
  each_pair do |k,v|
    if k.respond_to?(:key) && k.respond_to?(:to_mongo_query)
      hsh[k.key] ||= {}
      hsh[k.key].merge!(k.to_mongo_query(v))
    else
      hsh[k] = v
    end
  end
  hsh
end