active_redis_orm 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_redis/nil_object.rb +4 -0
- data/lib/active_redis/save.rb +5 -1
- data/lib/active_redis/version.rb +1 -1
- data/spec/lib/active_redis_spec.rb +8 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 835629f57538a971822d8594eb11be972232c5d1
|
4
|
+
data.tar.gz: 417ff294268b204aa1e2f22d865a36de727fd1bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8dc8e27c8638a909e9d0c5157c6e6835735fa8db5d92a8211e5ef01a43c31668bd34c19ba0465a5c8713c8f5508c88cc7ddc71f89ae5361a90ba2c8935a5951
|
7
|
+
data.tar.gz: 4f9d501a9a4516a9fcfe2ddba2402e6c28dd32e1df17a1e865b231c26bbe82e9aa2ee64b9d95e626e02d59582992b829128f02878238b45c8d09bbf74c34a334
|
data/lib/active_redis/save.rb
CHANGED
@@ -29,7 +29,11 @@ module ActiveRedis
|
|
29
29
|
run_callbacks :save do
|
30
30
|
Redis.current.pipelined do
|
31
31
|
self.changes.each do |key, value|
|
32
|
-
|
32
|
+
if value.last.nil?
|
33
|
+
send("#{key}_object").delete
|
34
|
+
else
|
35
|
+
send("set_#{key}", value)
|
36
|
+
end
|
33
37
|
end
|
34
38
|
end
|
35
39
|
@new_record = false
|
data/lib/active_redis/version.rb
CHANGED
@@ -56,6 +56,14 @@ describe ActiveRedis do
|
|
56
56
|
object.save
|
57
57
|
Redis.current.get("#{ActiveRedisObject.redis_namespace}:#{id}:foo").should == "I am foo"
|
58
58
|
end
|
59
|
+
|
60
|
+
it "nullifies stuff" do
|
61
|
+
object = ActiveRedisObject.create(date: Date.today)
|
62
|
+
object.date = nil
|
63
|
+
object.save
|
64
|
+
object.reload!
|
65
|
+
object.date_object.value.should be_nil
|
66
|
+
end
|
59
67
|
end
|
60
68
|
|
61
69
|
context "setters" do
|