activerecord_bulkoperation 0.0.4 → 0.0.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
- SHA256:
3
- metadata.gz: 8e7fa80792d9dbf81a8bf8225784e00ba349ac447a4fa4fd3f8fa3f36526318a
4
- data.tar.gz: 305ed3af749bbd57818e540a3c53e5a9f537096665d74102e54f9c85f765ea4b
2
+ SHA1:
3
+ metadata.gz: e0fdbe573c69d2ff5aa9df27fbf8203480723bbd
4
+ data.tar.gz: 7287e196ca1e4ef2f383396d1d43016a9ddc9148
5
5
  SHA512:
6
- metadata.gz: a03cd834a7fb83f0ee6bcd14787fb9de4230f70e7479bc611bec79cf2c9b456e1dd0608ec4b4b286f98372823ab37a33fe269102781a0031fcd374e7289fb8d7
7
- data.tar.gz: 6195763a68be42ef7ab69f241d10b47a0b8cc2714c0f2ec95cab0df0dcbcca2acf8de9660e50d4c31c0e19594520c8ab4de2545727bed8ce7f1eda4b91bf106e
6
+ metadata.gz: 2194265b91b93611aa60fd74e783f64dc49b14bc275a1bd27ac00414f6dc39dac1c5b5ea2e12396eda60e68173cffd3cc4c8591fe7a80e62c28375903c7dfc1f
7
+ data.tar.gz: ead7b3f0f9a96f0923b4cb3ab22fd8340a20247ed8d69381aa938e944bb2e893c447979b07293ceca5eb30603ce78e649d0839ec1aca6cc9e37b0f026d05dc38
@@ -12,6 +12,8 @@ module ActiveRecord
12
12
  fail ArgumentError.new('Array expected') unless values.is_a? Array
13
13
  values = [values] unless values.select { |i| not i.is_a? Array }.empty?
14
14
 
15
+ return 0 if values.empty?
16
+
15
17
  unless values.select { |i| not i.count == types.count }.empty?
16
18
  fail ArgumentError.new('types.count must be equal to arr.count for every arr in values')
17
19
  end
@@ -114,9 +116,11 @@ module ActiveRecord
114
116
 
115
117
  result = cursor.exec_array
116
118
 
117
- fail ExternalDataChange.new(sql) if result != values.count and optimistic
119
+ result_is_int = result.is_a? Integer
120
+
121
+ fail ExternalDataChange.new(sql) if result_is_int and result != values.count and optimistic
118
122
 
119
- affected_rows += result
123
+ affected_rows += result_is_int ? result : 0
120
124
 
121
125
  connection.send(:log, sql, 'Update') {}
122
126
  ensure
@@ -1,5 +1,5 @@
1
1
  module ActiveRecord
2
2
  module Bulkoperation
3
- VERSION = "0.0.4"
3
+ VERSION = "0.0.5"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord_bulkoperation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - OSP
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  version: '0'
113
113
  requirements: []
114
114
  rubyforge_project:
115
- rubygems_version: 2.7.6.2
115
+ rubygems_version: 2.5.2.1
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: ''