Skip to content

Instantly share code, notes, and snippets.

@kbullaughey
Created September 22, 2012 16:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kbullaughey/3766756 to your computer and use it in GitHub Desktop.
Save kbullaughey/3766756 to your computer and use it in GitHub Desktop.
Fixing upserts involving SCI collections in MongoMapper
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
@kbullaughey
Copy link
Author

I discuss this fix on my blog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment