counter_culture 3.5.1 → 3.5.3

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
  SHA256:
3
- metadata.gz: 6a69421ca46fbb8c213e7babacde9bb2d9fc365a956929855574f07b2f9d8d77
4
- data.tar.gz: 67f26aea01f3b1647da2266c492ca0241fb17615f9a2d6af55e55f8a01b4fe11
3
+ metadata.gz: 7c2646918dbfacac2d3d3f923c601111bfcf58b46b1ba0ed035e9f8a557b9577
4
+ data.tar.gz: 52cd080e6eb8beb589c8cfb52e73ad62fe333caea4c91d9098cbb5a78ff8f30f
5
5
  SHA512:
6
- metadata.gz: bd230e2a56efec0b5154a3568f00470829a123f36419e1297cb9f715be91755e30cbcc06bc0296c476d9e11df3b491adeff88b03631348be45b6f71b6f0f9ad9
7
- data.tar.gz: b43aec06f3bc6d12f92d02ee7501ad254e5e2138776bc688b24bea2b0dd3fe68aed3dc5018158bc02ba0e1cacfee57b83ac1cf33349c4ef6fd5f664d08855922
6
+ metadata.gz: b8736342d26f93e1cba9372057d941b216efda9bcefe8f56215b001b987e0a557f82e632376879a9006bf2b1d58cf876682f23efe7f6fb3912232d8de58442ea
7
+ data.tar.gz: a92f08b7574babb1c2e79b634b3f418f3e37e7d8b83abbddd8d1d9e909e4c073034b1f1b4f5534de5d9136967dc1863fcfec0a2f49e1c7620930d5c5ece617e9
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 3.5.3 (February 16, 2024)
2
+
3
+ Bugfixes:
4
+ - Correct polymorphic table name alias reference in join clauses (#388)
5
+
6
+ ## 3.5.2 (January 16, 2024)
7
+
8
+ Bugfixes:
9
+ - Assign attributes to the duped model on a lower level when determining whether a model has changed to avoid invoking unrelated callbacks (#386)
10
+
1
11
  ## 3.5.1 (January 8, 2024)
2
12
 
3
13
  Bugfixes:
data/README.md CHANGED
@@ -7,7 +7,7 @@ Turbo-charged counter caches for your Rails app. Huge improvements over the Rail
7
7
  * Supports dynamic column names, making it possible to split up the counter cache for different types of objects
8
8
  * Can keep a running count, or a running total
9
9
 
10
- Tested against Ruby 2.6, 2.7, 3.0, 3.1 and 3.2, and against the latest patch releases of Rails 5.2, 6.0, 6.1 and 7.0.
10
+ Tested against Ruby 2.6, 2.7, 3.0, 3.1, 3.2 and 3.3 and against the latest patch releases of Rails 5.2, 6.0, 6.1, 7.0 and 7.1.
11
11
 
12
12
  Please note that -- unlike Rails' built-in counter-caches -- counter_culture does not currently change the behavior of the `.size` method on ActiveRecord associations. If you want to avoid a database query and read the cached value, please use the attribute name containing the counter cache directly.
13
13
 
@@ -314,7 +314,9 @@ module CounterCulture
314
314
  changes_method = ACTIVE_RECORD_VERSION >= Gem::Version.new("5.1.0") ? :saved_changes : :changed_attributes
315
315
  obj.public_send(changes_method).each do |key, value|
316
316
  old_value = ACTIVE_RECORD_VERSION >= Gem::Version.new("5.1.0") ? value.first : value
317
- prev[key] = old_value
317
+ # We set old values straight to AR @attributes variable to avoid
318
+ # write_attribute callbacks from other gems (e.g. ArTransactionChanges)
319
+ prev.instance_variable_get(:@attributes).write_from_user(key, old_value)
318
320
  end
319
321
 
320
322
  prev
@@ -274,13 +274,13 @@ module CounterCulture
274
274
  # child in a Single Table Inheritance
275
275
  if reflect.active_record.column_names.include?('type') &&
276
276
  !model.descends_from_active_record?
277
- joins_sql += " AND #{target_table}.type IN ('#{model.name}')"
277
+ joins_sql += " AND #{target_table_alias}.type IN ('#{model.name}')"
278
278
  end
279
279
  if polymorphic?
280
280
  # adds 'type' condition to JOIN clause if the current model is a
281
281
  # polymorphic relation
282
282
  # NB only works for one-level relations
283
- joins_sql += " AND #{target_table}.#{reflect.foreign_type} = '#{relation_class.name}'"
283
+ joins_sql += " AND #{target_table_alias}.#{reflect.foreign_type} = '#{relation_class.name}'"
284
284
  end
285
285
  if index == reverse_relation.size - 1
286
286
  # conditions must be applied to the join on which we are counting
@@ -1,3 +1,3 @@
1
1
  module CounterCulture
2
- VERSION = '3.5.1'.freeze
2
+ VERSION = '3.5.3'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: counter_culture
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.5.1
4
+ version: 3.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Magnus von Koeller
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-09 00:00:00.000000000 Z
11
+ date: 2024-02-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord