active_redis_orm 0.1.4 → 0.1.5
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/attributes.rb +5 -7
- data/lib/active_redis/version.rb +1 -1
- data/spec/lib/active_redis_spec.rb +18 -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: 6d7c3d9ed198d3dd6fbd5147401eedf7083dba76
|
4
|
+
data.tar.gz: 8d4f17f419de4a58404b1b0928d9a1682e085883
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2627f854780770c987cdcf4ffb24e3728abcf02e78d4ee2990a412700b43dace1f54daf10022eba2473c09581c80e0fe138c141e811f81f848a0b3d088ae0d04
|
7
|
+
data.tar.gz: 82f812405070d304c856a6e7fcac0a9d577b02b90290b34882bd4a750ddc4b7b2b90fcecb09e62d4c9155213c39e8fd49b84d1fb1bbbf0437a7ddd67e6da1e91
|
@@ -283,13 +283,11 @@ module ActiveRedis
|
|
283
283
|
end
|
284
284
|
|
285
285
|
def set_#{field_name}(value)
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
#{field_name}_object.delete(drop)
|
292
|
-
end
|
286
|
+
new_value = value.last
|
287
|
+
|
288
|
+
#{field_name}_object.clear
|
289
|
+
#{field_name}_object.push(*new_value) if new_value.to_a.present?
|
290
|
+
|
293
291
|
#{field_name}.clean!
|
294
292
|
after_set(:#{field_name})
|
295
293
|
end
|
data/lib/active_redis/version.rb
CHANGED
@@ -409,4 +409,22 @@ describe ActiveRedis do
|
|
409
409
|
end
|
410
410
|
end
|
411
411
|
|
412
|
+
context "list order" do
|
413
|
+
it 'stores the list item in the order of insertion' do
|
414
|
+
o = ActiveRedisObject.new
|
415
|
+
o.list = ['a', 'b', 'c']
|
416
|
+
o.save
|
417
|
+
id = o.id
|
418
|
+
|
419
|
+
o = ActiveRedisObject.find(id)
|
420
|
+
expect(o.list).to eq(['a', 'b', 'c'])
|
421
|
+
|
422
|
+
o.list = ['c', 'b', 'a']
|
423
|
+
o.save
|
424
|
+
|
425
|
+
o = ActiveRedisObject.find(id)
|
426
|
+
expect(o.list).to eq(['c', 'b', 'a']) # => fails
|
427
|
+
end
|
428
|
+
end
|
429
|
+
|
412
430
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_redis_orm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Caspy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-10-
|
11
|
+
date: 2014-10-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|