activerecord-batch_touching 1.1 → 1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f994be54523c59f7878cbcf822ca03552bb3a365215cb3de7f23c05541381c75
4
- data.tar.gz: aeab5dbe2bebca4b0b88d2a77ce033b7a288969fe6bddb18c74e332ec729a6bf
3
+ metadata.gz: 4a79724b8d5920ced2e53071d67a37739bd098a6f66080c60a831d056c1fe4d2
4
+ data.tar.gz: 3ee4356cdc64f37ed0349f2f6e39c648f2013c04762021cb19959b3a9ac89b20
5
5
  SHA512:
6
- metadata.gz: '0808dfbb8f5ea2fedbd51feaf8c453f9224699017d5c33c54a8c08ff02396b52524b67691937ba9b48b838f84257abf0eab3280500bb976945b7eec7302fc89a'
7
- data.tar.gz: 4237add83e7f90d3c6852f3221daa31e798eedc2a2b780193e2eab71ae8d17c831c8d2076d899bfed1e84cf830285d501d820fd34ca942223e0f7b53dc5876f2
6
+ metadata.gz: c72e5f701b3573d121c9034f2e5751821b8b129c3411584ada3b6fff0b2e12ac52b717128b257808ce54416588dfea4b3dcc597e2e375fda31b0757cf599d770
7
+ data.tar.gz: 61cf15c6e237c604347af26f37c1033fdb2e895a5ead9e01078b706e73a0642a332795828c7ca81b4e17628bd81dd9385e7e3bfea2005f6b66f012347d07fa74
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Activerecord
4
4
  module BatchTouching
5
- VERSION = "1.1"
5
+ VERSION = "1.2"
6
6
  end
7
7
  end
@@ -178,7 +178,8 @@ module ActiveRecord
178
178
  sql = columns.map { |column| "#{klass.connection.quote_column_name(column)} = :time" }.join(", ")
179
179
  sql += ", #{klass.locking_column} = #{klass.locking_column} + 1" if klass.locking_enabled?
180
180
 
181
- klass.unscoped.where(klass.primary_key => records.to_a).update_all([sql, time: time])
181
+ ids = records.map { |record| record.send(klass.primary_key) }.sort
182
+ klass.unscoped.where(klass.primary_key => ids).update_all([sql, time: time])
182
183
  end
183
184
 
184
185
  # Set new timestamp in memory, without updating the DB just yet.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-batch_touching
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.1'
4
+ version: '1.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Morearty
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-07-07 00:00:00.000000000 Z
12
+ date: 2022-07-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord