Created
September 22, 2012 16:57
-
-
Save kbullaughey/3766756 to your computer and use it in GitHub Desktop.
Fixing upserts involving SCI collections in MongoMapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MongoMapper | |
module Plugins | |
module Sci | |
module ClassMethods | |
# I override this method so that it works with upserts. | |
def criteria_hash(criteria={}) | |
criteria = criteria.merge(:_type => name) if single_collection_inherited? | |
super criteria | |
end | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I discuss this fix on my blog