counter_culture 2.6.2 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/README.md +4 -0
- data/lib/counter_culture/extensions.rb +3 -2
- data/lib/counter_culture/reconciler.rb +4 -0
- data/lib/counter_culture/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74fff95505913ba522b3ec93bc9101c375c7de5678744145a0e4959f2c267361
|
4
|
+
data.tar.gz: bc284f87da6f949e7d875b7f30c43accbe23ce5716601af9fc4143eb6346954d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e63708745c4ffbb727a1b4da61a0d027de76d7256ee5d9669fa0f18dfcc2b183f26ddc109f45d6af6fb68a79c040e73872f647e8453c7b801e390036601878eb
|
7
|
+
data.tar.gz: c58c36d4aaf450450d913ad93487c7012de5de0ba8bb4f99c83a3994b64e8aed19f04a0d62c0df21ceda862312b9c010af042857709d891f746e20403ef893f2
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -270,6 +270,10 @@ Product.counter_culture_fix_counts only: :category
|
|
270
270
|
Product.counter_culture_fix_counts only: [[:subcategory, :category]]
|
271
271
|
# will automatically fix counts only on the two-level [:subcategory, :category] relation on Product
|
272
272
|
|
273
|
+
Product.counter_culture_fix_counts column_name: :reviews_count
|
274
|
+
# will automatically fix counts only on the :reviews_count column on Product
|
275
|
+
# This allows us to skip the columns that have already been processed. This is useful after running big DB changes that affect only one counter cache column.
|
276
|
+
|
273
277
|
# :except and :only also accept arrays
|
274
278
|
|
275
279
|
Product.counter_culture_fix_counts verbose: true
|
@@ -59,7 +59,8 @@ module CounterCulture
|
|
59
59
|
#
|
60
60
|
# options:
|
61
61
|
# { :exclude => list of relations to skip when fixing counts,
|
62
|
-
# :only => only these relations will have their counts fixed
|
62
|
+
# :only => only these relations will have their counts fixed,
|
63
|
+
# :column_name => only this column will have its count fixed }
|
63
64
|
# returns: a list of fixed record as an array of hashes of the form:
|
64
65
|
# { :entity => which model the count was fixed on,
|
65
66
|
# :id => the id of the model that had the incorrect count,
|
@@ -79,7 +80,7 @@ module CounterCulture
|
|
79
80
|
next if options[:exclude] && options[:exclude].include?(counter.relation)
|
80
81
|
next if options[:only] && !options[:only].include?(counter.relation)
|
81
82
|
|
82
|
-
reconciler_options = %i(batch_size finish skip_unsupported start touch verbose where)
|
83
|
+
reconciler_options = %i(batch_size column_name finish skip_unsupported start touch verbose where)
|
83
84
|
|
84
85
|
reconciler = CounterCulture::Reconciler.new(counter, options.slice(*reconciler_options))
|
85
86
|
reconciler.reconcile!
|
@@ -76,6 +76,10 @@ module CounterCulture
|
|
76
76
|
|
77
77
|
counter_column_names = column_names || {nil => counter_cache_name}
|
78
78
|
|
79
|
+
if options[:column_name]
|
80
|
+
counter_column_names = counter_column_names.select{ |_, v| options[:column_name].to_s == v }
|
81
|
+
end
|
82
|
+
|
79
83
|
# iterate over all the possible counter cache column names
|
80
84
|
counter_column_names.each do |where, column_name|
|
81
85
|
# if the column name is nil, that means those records don't affect
|
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: 2.
|
4
|
+
version: 2.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Magnus von Koeller
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -275,7 +275,7 @@ homepage: https://github.com/magnusvk/counter_culture
|
|
275
275
|
licenses:
|
276
276
|
- MIT
|
277
277
|
metadata: {}
|
278
|
-
post_install_message:
|
278
|
+
post_install_message:
|
279
279
|
rdoc_options: []
|
280
280
|
require_paths:
|
281
281
|
- lib
|
@@ -290,8 +290,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
290
290
|
- !ruby/object:Gem::Version
|
291
291
|
version: '0'
|
292
292
|
requirements: []
|
293
|
-
rubygems_version: 3.1.
|
294
|
-
signing_key:
|
293
|
+
rubygems_version: 3.1.4
|
294
|
+
signing_key:
|
295
295
|
specification_version: 4
|
296
296
|
summary: Turbo-charged counter caches for your Rails app.
|
297
297
|
test_files: []
|