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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4cf1a60fe40cbc3ca7157cb6908c6313c8b098f3
4
- data.tar.gz: 3181c522dee6fffe76007f91f315e4b1d0d4607f
3
+ metadata.gz: 6d7c3d9ed198d3dd6fbd5147401eedf7083dba76
4
+ data.tar.gz: 8d4f17f419de4a58404b1b0928d9a1682e085883
5
5
  SHA512:
6
- metadata.gz: 4f342d78a19d49459d42648ad9853b4d706178a971cb0d2c7a4073b3557e4f298ec293fb5c31d5f928f80f0beb1cb145d8be93519132248597aa94f7477ef402
7
- data.tar.gz: 3f6192eefe2d7848cec11543b8eb392c56e89d61259504427b13340c986e9bd8fa72965551ace8d756d07db0c539cede1a0cf4ff15b2fc895533a0e2e07c0843
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
- changes = value.first.last
287
- changes[:additions].each do |addition|
288
- #{field_name}_object.push(addition)
289
- end
290
- changes[:drops].each do |drop|
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
@@ -1,3 +1,3 @@
1
1
  module ActiveRedis
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.5"
3
3
  end
@@ -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
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-12 00:00:00.000000000 Z
11
+ date: 2014-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler