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: ea1d2ba178b8f954997d629e4c9a3a15778a4665
4
- data.tar.gz: 927a91641d773d1581c8fcdbdbb9597254d12994
3
+ metadata.gz: 4906bb6f73e98fee1490a6470ec0e6fb5d46e799
4
+ data.tar.gz: 6304957da987dd1e9315a3a3ce8be4b1bb720bd9
5
5
  SHA512:
6
- metadata.gz: ad6610a34a060ab4bb06c89b3c33acda3578a47b72e69b68acdd3ddb81d2beb245dd27c32f26bdc5af740ecf2b4a3d419465e54da287c46f12147285c0fce497
7
- data.tar.gz: 0ab419118d5511b0176a2720d26a4cb24c29336c823f949eb5e4538fb69a567b5dc111cd40e1e5a677d15eb48c4e81a326e684b93f4ae46eca0fea8e9d9602b1
6
+ metadata.gz: 40b81ab32f081801cffa81d68921fc94b3dd6f62284d9c3cf54081c8f949203c2417c51b7e9d6a93e8bcac557d9124632d706a12eb45023f33a0a6ebaa48e95d
7
+ data.tar.gz: e99818a708e9b58f6d5924e6af43eb0a0f7446b50c8cfaa3c98a0bdfcb6ca1b281b62e79a39d44c1043629fd1ea08b46c1e1218d8d0200590dd356f782394df7
data/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
+ ## activerecord-turntable 2.0.2 ##
2
+
3
+ ### Bugfixes
4
+
5
+ * Fix method definition bug on 2.0.1
6
+
1
7
  ## activerecord-turntable 2.0.1 ##
2
8
 
3
9
  ### Bugfixes
10
+
4
11
  * support `update_columns`
5
12
 
6
13
  ## activerecord-turntable 2.0.0 ##
@@ -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
- # @note Override to add sharding scope on `update_columns`
61
- def update_columns(attributes)
62
- raise ActiveRecordError, "cannot update on a new record object" unless persisted?
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
- update_scope = if turntable_enabled? and self.class.primary_key != self.class.turntable_shard_key.to_s
69
- self.class.unscoped.where(self.class.turntable_shard_key => self.send(turntable_shard_key))
70
- else
71
- self.class.unscoped
72
- end
67
+ attributes.each_key do |key|
68
+ verify_readonly_attribute(key.to_s)
69
+ end
73
70
 
74
- updated_count = update_scope.where(self.class.primary_key => id).update_all(attributes)
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
- attributes.each do |k, v|
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
- updated_count == 1
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
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Turntable
3
- VERSION = "2.0.1"
3
+ VERSION = "2.0.2"
4
4
  end
5
5
  end
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.1
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-15 00:00:00.000000000 Z
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: