volt 0.7.17 → 0.7.18
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d287b57490af57c686f9f3b8a45dda2d953a8a19
|
4
|
+
data.tar.gz: 97a0201eda5adc10704ea7c689e27d596fff315b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d0c17a7964f2f2b3a1d63cb299bed4f3160f40ac595425b04788fffe88d3b7a67fc83fd418d45b53c27b449c6ba55d6a0ba5dbd058368c0ec6b0c7255baf607
|
7
|
+
data.tar.gz: 6d6c453d1192cba6e277326f368d885973b5ee603d1303001a2b3b8cded4c6f82014a5006a7ed1d1b44c41ceac4dd582ec966fcf099e7548605ca91da938421c
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.18
|
@@ -37,11 +37,13 @@ class StoreTasks
|
|
37
37
|
errors = model_errors(collection, data)
|
38
38
|
|
39
39
|
if errors.size == 0
|
40
|
+
# id = BSON::ObjectId(data[:_id])
|
40
41
|
id = data[:_id]
|
41
42
|
|
42
43
|
# Try to create
|
43
44
|
# TODO: Seems mongo is dumb and doesn't let you upsert with custom id's
|
44
45
|
begin
|
46
|
+
# data['_id'] = BSON::ObjectId('_id') if data['_id']
|
45
47
|
@@db[collection].insert(data)
|
46
48
|
rescue Mongo::OperationFailure => error
|
47
49
|
# Really mongo client?
|
@@ -5,7 +5,7 @@ module Persistors
|
|
5
5
|
class ModelStore < Store
|
6
6
|
include StoreState
|
7
7
|
|
8
|
-
ID_CHARS = [('a'..'
|
8
|
+
ID_CHARS = [('a'..'f'), ('0'..'9')].map {|v| v.to_a }.flatten
|
9
9
|
|
10
10
|
attr_reader :model
|
11
11
|
attr_accessor :in_identity_map
|
@@ -46,7 +46,7 @@ module Persistors
|
|
46
46
|
# Create a random unique id that can be used as the mongo id as well
|
47
47
|
def generate_id
|
48
48
|
id = []
|
49
|
-
|
49
|
+
24.times { id << ID_CHARS.sample }
|
50
50
|
|
51
51
|
return id.join
|
52
52
|
end
|