lib/mongo_mapper/plugins/modifiers.rb in mongo_mapper-0.7.6 vs lib/mongo_mapper/plugins/modifiers.rb in mongo_mapper-0.8.0
- old
+ new
@@ -1,5 +1,6 @@
+# encoding: UTF-8
module MongoMapper
module Plugins
module Modifiers
module ClassMethods
def increment(*args)
@@ -27,11 +28,11 @@
else
keys, ids = args.partition { |arg| arg.is_a?(Symbol) }
criteria = {:id => ids}
end
- criteria = query(criteria).criteria.to_hash
+ criteria = criteria_hash(criteria).to_hash
modifiers = keys.inject({}) { |hash, key| hash[key] = 1; hash }
collection.update(criteria, {'$unset' => modifiers}, :multi => true)
end
def push(*args)
@@ -66,10 +67,10 @@
end
def criteria_and_keys_from_args(args)
keys = args.pop
criteria = args[0].is_a?(Hash) ? args[0] : {:id => args}
- [query(criteria).criteria.to_hash, keys]
+ [criteria_hash(criteria).to_hash, keys]
end
end
module InstanceMethods
def unset(*keys)
\ No newline at end of file