ohm 3.0.2 → 3.0.3
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/ohm.rb +12 -3
- data/ohm.gemspec +1 -1
- data/test/uniques.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 94a422b709084441dabd2d9c04a38014ec6ddbef
|
4
|
+
data.tar.gz: 8549e0842a0737e65a5d459f483b1002e8914ecf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 404357ab09aa51976a53ddc7fe43a31b29030f6067386daca0787fe8cd7d6cb1dbb80fabaee8c839aa23d576f9772dc66584df17e27c37317392aed7ac7f1927
|
7
|
+
data.tar.gz: 5cffd617b9e7e3119d1dc2d1f241a1107bafd7bdb7b53d4e78745e9d7f1570ceb1c887d488353c9d15782da0c27b750987299c321bb770e0e2eaf34326fb4d84
|
data/CHANGELOG.md
CHANGED
data/lib/ohm.rb
CHANGED
@@ -1334,10 +1334,16 @@ module Ohm
|
|
1334
1334
|
#
|
1335
1335
|
def save
|
1336
1336
|
indices = {}
|
1337
|
-
model.indices.each
|
1337
|
+
model.indices.each do |field|
|
1338
|
+
next unless (value = send(field))
|
1339
|
+
indices[field] = Array(value).map(&:to_s)
|
1340
|
+
end
|
1338
1341
|
|
1339
1342
|
uniques = {}
|
1340
|
-
model.uniques.each
|
1343
|
+
model.uniques.each do |field|
|
1344
|
+
next unless (value = send(field))
|
1345
|
+
uniques[field] = value.to_s
|
1346
|
+
end
|
1341
1347
|
|
1342
1348
|
features = {
|
1343
1349
|
"name" => model.name
|
@@ -1367,7 +1373,10 @@ module Ohm
|
|
1367
1373
|
#
|
1368
1374
|
def delete
|
1369
1375
|
uniques = {}
|
1370
|
-
model.uniques.each
|
1376
|
+
model.uniques.each do |field|
|
1377
|
+
next unless (value = send(field))
|
1378
|
+
uniques[field] = value.to_s
|
1379
|
+
end
|
1371
1380
|
|
1372
1381
|
script(LUA_DELETE, 0,
|
1373
1382
|
{ "name" => model.name,
|
data/ohm.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = "ohm"
|
3
|
-
s.version = "3.0.
|
3
|
+
s.version = "3.0.3"
|
4
4
|
s.summary = %{Object-hash mapping library for Redis.}
|
5
5
|
s.description = %Q{Ohm is a library that allows to store an object in Redis, a persistent key-value database. It has very good performance.}
|
6
6
|
s.authors = ["Michel Martens", "Damian Janowski", "Cyril David"]
|
data/test/uniques.rb
CHANGED
@@ -96,3 +96,13 @@ test "unique virtual attribute" do
|
|
96
96
|
User.create(:email => "baz@yahoo.com")
|
97
97
|
end
|
98
98
|
end
|
99
|
+
|
100
|
+
test "nil doesn't count for uniques" do
|
101
|
+
u1 = User.create
|
102
|
+
u2 = User.create
|
103
|
+
|
104
|
+
assert u1.id
|
105
|
+
assert u2.id
|
106
|
+
|
107
|
+
assert u1.id != u2.id
|
108
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ohm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michel Martens
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2016-
|
13
|
+
date: 2016-06-15 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: redic
|