activerecord-turntable 2.0.1 → 2.0.2
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4906bb6f73e98fee1490a6470ec0e6fb5d46e799
|
4
|
+
data.tar.gz: 6304957da987dd1e9315a3a3ce8be4b1bb720bd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40b81ab32f081801cffa81d68921fc94b3dd6f62284d9c3cf54081c8f949203c2417c51b7e9d6a93e8bcac557d9124632d706a12eb45023f33a0a6ebaa48e95d
|
7
|
+
data.tar.gz: e99818a708e9b58f6d5924e6af43eb0a0f7446b50c8cfaa3c98a0bdfcb6ca1b281b62e79a39d44c1043629fd1ea08b46c1e1218d8d0200590dd356f782394df7
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
module ActiveRecord::Turntable::ActiveRecordExt
|
2
2
|
module Persistence
|
3
|
+
extend ActiveSupport::Concern
|
4
|
+
|
3
5
|
::ActiveRecord::Persistence.class_eval do
|
4
6
|
# @note Override to add sharding scope on reloading
|
5
7
|
def reload(options = nil)
|
@@ -56,29 +58,29 @@ module ActiveRecord::Turntable::ActiveRecordExt
|
|
56
58
|
|
57
59
|
finder_scope.where(primary_key => self[primary_key]).update_all(changes) == 1
|
58
60
|
end
|
61
|
+
end
|
59
62
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
attributes.each_key do |key|
|
65
|
-
verify_readonly_attribute(key.to_s)
|
66
|
-
end
|
63
|
+
# @note Override to add sharding scope on `update_columns`
|
64
|
+
def update_columns(attributes)
|
65
|
+
raise ActiveRecordError, "cannot update on a new record object" unless persisted?
|
67
66
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
self.class.unscoped
|
72
|
-
end
|
67
|
+
attributes.each_key do |key|
|
68
|
+
verify_readonly_attribute(key.to_s)
|
69
|
+
end
|
73
70
|
|
74
|
-
|
71
|
+
update_scope = if turntable_enabled? and self.class.primary_key != self.class.turntable_shard_key.to_s
|
72
|
+
self.class.unscoped.where(self.class.turntable_shard_key => self.send(turntable_shard_key))
|
73
|
+
else
|
74
|
+
self.class.unscoped
|
75
|
+
end
|
75
76
|
|
76
|
-
|
77
|
-
raw_write_attribute(k, v)
|
78
|
-
end
|
77
|
+
updated_count = update_scope.where(self.class.primary_key => id).update_all(attributes)
|
79
78
|
|
80
|
-
|
79
|
+
attributes.each do |k, v|
|
80
|
+
raw_write_attribute(k, v)
|
81
81
|
end
|
82
|
+
|
83
|
+
updated_count == 1
|
82
84
|
end
|
83
85
|
|
84
86
|
private
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-turntable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- gussan
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-11-
|
12
|
+
date: 2014-11-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|
@@ -481,3 +481,4 @@ test_files:
|
|
481
481
|
- spec/spec_helper.rb
|
482
482
|
- spec/support/matchers/be_saved_to.rb
|
483
483
|
- spec/support/turntable_helper.rb
|
484
|
+
has_rdoc:
|