record_redis 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/redis_record/base.rb +4 -4
- data/lib/redis_record/version.rb +1 -1
- data/spec/lib/redis_record/base_spec.rb +5 -3
- metadata +4 -4
data/lib/redis_record/base.rb
CHANGED
@@ -43,7 +43,7 @@ module RedisRecord
|
|
43
43
|
def update(attributes)
|
44
44
|
@hash_of_properties.merge!(attributes)
|
45
45
|
name= self.class
|
46
|
-
key= @hash_of_properties["
|
46
|
+
key= @hash_of_properties["Key"]
|
47
47
|
value= @hash_of_properties
|
48
48
|
|
49
49
|
RedisRecord::Connection.connect unless RedisRecord::Connection.isConnected?
|
@@ -55,10 +55,10 @@ module RedisRecord
|
|
55
55
|
#TODO: returns entitiy or nil if failed
|
56
56
|
def self.create(opts)
|
57
57
|
@hash_of_properties= opts
|
58
|
-
@hash_of_properties[:
|
58
|
+
@hash_of_properties[:Key]= generate_key if @hash_of_properties[:Key].nil?
|
59
59
|
|
60
60
|
name= self.name
|
61
|
-
key= @hash_of_properties[:
|
61
|
+
key= @hash_of_properties[:Key]
|
62
62
|
value= @hash_of_properties
|
63
63
|
|
64
64
|
RedisRecord::Connection.connect unless RedisRecord::Connection.isConnected?
|
@@ -70,7 +70,7 @@ module RedisRecord
|
|
70
70
|
|
71
71
|
def delete
|
72
72
|
name= self.class
|
73
|
-
key= @hash_of_properties["
|
73
|
+
key= @hash_of_properties["Key"]
|
74
74
|
RedisRecord::Connection.connect unless RedisRecord::Connection.isConnected?
|
75
75
|
result= RedisRecord::Connection.connection.hdel(name,key)
|
76
76
|
result
|
data/lib/redis_record/version.rb
CHANGED
@@ -33,7 +33,7 @@ describe RedisRecord::Base do
|
|
33
33
|
|
34
34
|
describe '#create' do
|
35
35
|
it 'should play arround' do
|
36
|
-
network= Network.create({:
|
36
|
+
network= Network.create({:Name => "paul", :Key => "1234567890"})
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -76,14 +76,16 @@ describe RedisRecord::Base do
|
|
76
76
|
|
77
77
|
describe '#update' do
|
78
78
|
it 'should update a existing model entity' do
|
79
|
-
|
79
|
+
Network.create({:Name => "paul", :Key => "1234567890_for_update"})
|
80
|
+
network= Network.find("1234567890_for_update")
|
80
81
|
network.update({"name" => "updatedNetwork"})
|
81
82
|
end
|
82
83
|
end
|
83
84
|
|
84
85
|
describe '#delete' do
|
85
86
|
it 'should remove a existing entity' do
|
86
|
-
|
87
|
+
Network.create({:Name => "paul", :Key => "1234567890_for_delete"})
|
88
|
+
network= Network.find("1234567890_for_delete")
|
87
89
|
network.delete.should be_true
|
88
90
|
end
|
89
91
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: record_redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-10-
|
12
|
+
date: 2013-10-12 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: redis
|
@@ -112,7 +112,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
112
112
|
version: '0'
|
113
113
|
segments:
|
114
114
|
- 0
|
115
|
-
hash:
|
115
|
+
hash: 4242796866362044316
|
116
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
117
117
|
none: false
|
118
118
|
requirements:
|
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
121
121
|
version: '0'
|
122
122
|
segments:
|
123
123
|
- 0
|
124
|
-
hash:
|
124
|
+
hash: 4242796866362044316
|
125
125
|
requirements: []
|
126
126
|
rubyforge_project:
|
127
127
|
rubygems_version: 1.8.25
|