lib/collector/repository.rb in collector-0.0.18 vs lib/collector/repository.rb in collector-0.0.19
- old
+ new
@@ -31,9 +31,13 @@
def save_without_updating_timestamps(model)
attributes = serialize!(model)
collection.save(attributes)
end
+ def delete(model)
+ collection.remove(_id: normalize_id(model.id))
+ end
+
def serialize!(model)
attributes = serialize(model)
attributes["_id"] = BSON::ObjectId.from_string(attributes.delete("id")) if attributes["id"]
attributes.reject! { |key, val| val.nil? }
attributes