counter_culture 3.11.0 → 3.11.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 +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +1 -1
- data/lib/counter_culture/counter.rb +10 -1
- data/lib/counter_culture/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c568fc84225757b834a008eb60dbadfe5dea148078c855fe76a2b5711b0c5b1e
|
4
|
+
data.tar.gz: 3abc94f197b60fb6778eadb98ad402e6b961155c492970111b85bbf1bd171237
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: adfd25e90ca300e1d6bc19296b343a8fbd9a272076e48591dddc513ffa4173dff10ef2d26cec6bd08bdfbc372ccf1b94e97cee7d7827205523efe0278d1bffea
|
7
|
+
data.tar.gz: 733126919913da347057de9c81cbbdf7b4b45e9ea1bbbecad12586a06432801e37b1c8833078cc93ce11fdc0ad3b201c5484822dcebc708f970d2106c022d35b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## 3.11.2 (July 10, 2025)
|
2
|
+
|
3
|
+
Bugfixes:
|
4
|
+
- Fix regression for foreign_key_values by adding support for composite primary keys (#417)
|
5
|
+
|
6
|
+
## 3.11.1 (June 27, 2025)
|
7
|
+
|
8
|
+
Bugfixes:
|
9
|
+
- Don't attempt to modify frozen association object (#416)
|
10
|
+
|
1
11
|
## 3.11.0 (June 26, 2025)
|
2
12
|
|
3
13
|
New features:
|
data/README.md
CHANGED
@@ -232,7 +232,7 @@ The ```:delta_column``` option supports all numeric column types, not just ```:i
|
|
232
232
|
class Product < ActiveRecord::Base
|
233
233
|
belongs_to :category
|
234
234
|
counter_culture :category, foreign_key_values:
|
235
|
-
proc {|category_id| [category_id, Category.
|
235
|
+
proc {|category_id| [category_id, Category.find_by(id: category_id)&.parent_category&.id] }
|
236
236
|
end
|
237
237
|
|
238
238
|
class Category < ActiveRecord::Base
|
@@ -108,6 +108,15 @@ module CounterCulture
|
|
108
108
|
|
109
109
|
primary_key = relation_primary_key(relation, source: obj, was: options[:was])
|
110
110
|
|
111
|
+
if foreign_key_values && id_to_change.is_a?(Enumerable) && id_to_change.count > 1 &&
|
112
|
+
Array.wrap(primary_key).count == 1
|
113
|
+
# To keep this feature backwards compatible, we need to accommodate a case where
|
114
|
+
# `foreign_key_values` returns an array, but we're _not_ using composite primary
|
115
|
+
# keys. In that case, we need to wrap the `id_to_change` in one more array to keep
|
116
|
+
# it compatible with the `.zip` call in `primary_key_conditions`.
|
117
|
+
id_to_change = [id_to_change]
|
118
|
+
end
|
119
|
+
|
111
120
|
if Thread.current[:aggregate_counter_updates]
|
112
121
|
Thread.current[:primary_key_map][klass] ||= primary_key
|
113
122
|
end
|
@@ -378,7 +387,7 @@ module CounterCulture
|
|
378
387
|
association_name = relation_reflect(relation).name
|
379
388
|
|
380
389
|
association_object = association_object_for_assign(obj, association_name)
|
381
|
-
return if association_object.blank?
|
390
|
+
return if association_object.blank? || association_object.frozen?
|
382
391
|
|
383
392
|
association_object.assign_attributes(
|
384
393
|
change_counter_column =>
|
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.11.
|
4
|
+
version: 3.11.2
|
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: 2025-
|
11
|
+
date: 2025-07-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|