Permalink
Browse files

Merge branch 'bug/issue-421'

  • Loading branch information...
andrewtimberlake committed Jun 2, 2012
2 parents 4d35c67 + f205122 commit fd4201c75ae06e5a946690d706fe136844298f07
Showing with 242 additions and 221 deletions.
  1. +13 −13 lib/mongo_mapper/plugins/modifiers.rb
  2. +229 −208 test/functional/test_modifiers.rb
@@ -71,7 +71,7 @@ def modifier_update(modifier, args)
collection.update(criteria, {modifier => updates}, options.merge(:multi => true))
else
collection.update(criteria, {modifier => updates}, :multi => true)
- end
+ end
end
def criteria_and_keys_from_args(args)
@@ -84,51 +84,51 @@ def criteria_and_keys_from_args(args)
criteria = {:id => split_args[0]}
updates = split_args[1].first
options = split_args[1].last
- end
+ end
[criteria_hash(criteria).to_hash, updates, options]
end
end
def unset(*args)
- self.class.unset(id, *args)
+ self.class.unset({:_id => id}, *args)
end
def increment(hash, options=nil)
- self.class.increment(id, hash, options)
+ self.class.increment({:_id => id}, hash, options)
end
def decrement(hash, options=nil)
- self.class.decrement(id, hash, options)
+ self.class.decrement({:_id => id}, hash, options)
end
def set(hash, options=nil)
- self.class.set(id, hash, options)
+ self.class.set({:_id => id}, hash, options)
end
def push(hash, options=nil)
- self.class.push(id, hash, options)
+ self.class.push({:_id => id}, hash, options)
end
def push_all(hash, options=nil)
- self.class.push_all(id, hash, options)
+ self.class.push_all({:_id => id}, hash, options)
end
def pull(hash, options=nil)
- self.class.pull(id, hash, options)
+ self.class.pull({:_id => id}, hash, options)
end
def pull_all(hash, options=nil)
- self.class.pull_all(id, hash, options)
+ self.class.pull_all({:_id => id}, hash, options)
end
def add_to_set(hash, options=nil)
- self.class.push_uniq(id, hash, options)
+ self.class.push_uniq({:_id => id}, hash, options)
end
alias push_uniq add_to_set
def pop(hash, options=nil)
- self.class.pop(id, hash, options)
+ self.class.pop({:_id => id}, hash, options)
end
end
end
-end
+end
Oops, something went wrong.

0 comments on commit fd4201c

Please sign in to comment.