uorm 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/uorm/redis/persistance.rb +5 -9
- data/lib/uorm/version.rb +1 -1
- metadata +1 -1
@@ -13,17 +13,13 @@ module Uorm
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def all options = {}
|
16
|
-
|
17
|
-
return [] if
|
18
|
-
|
19
|
-
collection.mget(keys).map do |val|
|
20
|
-
MultiJson.load val if val
|
21
|
-
end
|
16
|
+
ids = collection.keys
|
17
|
+
return [] if ids.empty?
|
18
|
+
ids.map { |id| find id }
|
22
19
|
end
|
23
20
|
|
24
21
|
def find id
|
25
|
-
|
26
|
-
MultiJson.load data if data
|
22
|
+
collection.mapped_hmget id, *model.fields.map(&:name)
|
27
23
|
end
|
28
24
|
|
29
25
|
def create object
|
@@ -42,7 +38,7 @@ module Uorm
|
|
42
38
|
private
|
43
39
|
|
44
40
|
def write object
|
45
|
-
collection.
|
41
|
+
collection.mapped_hmset object.id, object.attributes
|
46
42
|
end
|
47
43
|
end
|
48
44
|
end
|
data/lib/uorm/version.rb
CHANGED