counter_culture 3.3.0 → 3.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +10 -1
- data/CHANGELOG.md +5 -0
- data/README.md +3 -2
- data/counter_culture.gemspec +1 -1
- data/lib/counter_culture/counter.rb +2 -0
- data/lib/counter_culture/version.rb +1 -1
- metadata +4 -5
- data/circle.yml +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce78ea0f9a3ad552e5cb8b0e230dbc70fc3fcb51f9f0c21676c3ecca7601569a
|
4
|
+
data.tar.gz: 840001761832861fbbef2e3d921d553d0ea39c685a8ab16b4096444722bb5d03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 41e59967d03892c1d0ce48d1c804862bcd0ffb575df9675869fc94fcba13440f8eaf07f4a06b6b5b88a168c79efd06af4a4b88634f8bdc9d8ca0b5c990b0c81f
|
7
|
+
data.tar.gz: 1e90fa445eb4972dea2c7ce851719e8fa0a095aa2526b177fd1d2ec5ae9de8d85f4bf9d1b3cc1a112a1186f76add7b7d564efab9bb146085fdf1c1011cda5ebf
|
data/.circleci/config.yml
CHANGED
@@ -48,7 +48,7 @@ workflows:
|
|
48
48
|
- test:
|
49
49
|
matrix:
|
50
50
|
parameters:
|
51
|
-
ruby-version: ["2.6", "2.7", "3.0", "3.1"]
|
51
|
+
ruby-version: ["2.6", "2.7", "3.0", "3.1", "3.2"]
|
52
52
|
rails-version: ["5.2", "6.0", "6.1", "7.0"]
|
53
53
|
database: ["postgresql", "sqlite3", "mysql2"]
|
54
54
|
exclude:
|
@@ -67,6 +67,15 @@ workflows:
|
|
67
67
|
- ruby-version: "3.1"
|
68
68
|
rails-version: "5.2"
|
69
69
|
database: "sqlite3"
|
70
|
+
- ruby-version: "3.2"
|
71
|
+
rails-version: "5.2"
|
72
|
+
database: "mysql2"
|
73
|
+
- ruby-version: "3.2"
|
74
|
+
rails-version: "5.2"
|
75
|
+
database: "postgresql"
|
76
|
+
- ruby-version: "3.2"
|
77
|
+
rails-version: "5.2"
|
78
|
+
database: "sqlite3"
|
70
79
|
- ruby-version: "3.1"
|
71
80
|
rails-version: "5.2"
|
72
81
|
database: "mysql2"
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -7,10 +7,11 @@ 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 and 3.
|
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.
|
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
|
+
|
14
|
+
```ruby
|
14
15
|
product.categories.size # => will lead to a SELECT COUNT(*) query
|
15
16
|
product.categories_count # => will use counter cache without query
|
16
17
|
```
|
data/counter_culture.gemspec
CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |spec|
|
|
13
13
|
spec.homepage = 'https://github.com/magnusvk/counter_culture'
|
14
14
|
spec.license = 'MIT'
|
15
15
|
|
16
|
-
spec.required_ruby_version =
|
16
|
+
spec.required_ruby_version = '>= 2.6'
|
17
17
|
|
18
18
|
# Specify which files should be added to the gem when it is released.
|
19
19
|
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
@@ -284,6 +284,8 @@ module CounterCulture
|
|
284
284
|
if reflect.options.key?(:polymorphic)
|
285
285
|
raise "can't handle multiple keys with polymorphic associations" unless (relation.is_a?(Symbol) || relation.length == 1)
|
286
286
|
raise "must specify source for polymorphic associations..." unless source
|
287
|
+
|
288
|
+
return reflect.options[:primary_key] if reflect.options.key?(:primary_key)
|
287
289
|
return relation_klass(relation, source: source, was: was).try(:primary_key)
|
288
290
|
end
|
289
291
|
reflect.association_primary_key(klass)
|
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.3.
|
4
|
+
version: 3.3.1
|
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:
|
11
|
+
date: 2023-06-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -312,7 +312,6 @@ files:
|
|
312
312
|
- LICENSE.txt
|
313
313
|
- README.md
|
314
314
|
- Rakefile
|
315
|
-
- circle.yml
|
316
315
|
- counter_culture.gemspec
|
317
316
|
- gemfiles/rails_5.2.gemfile
|
318
317
|
- gemfiles/rails_6.0.gemfile
|
@@ -337,14 +336,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
337
336
|
requirements:
|
338
337
|
- - ">="
|
339
338
|
- !ruby/object:Gem::Version
|
340
|
-
version: 2.
|
339
|
+
version: '2.6'
|
341
340
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
342
341
|
requirements:
|
343
342
|
- - ">="
|
344
343
|
- !ruby/object:Gem::Version
|
345
344
|
version: '0'
|
346
345
|
requirements: []
|
347
|
-
rubygems_version: 3.
|
346
|
+
rubygems_version: 3.4.2
|
348
347
|
signing_key:
|
349
348
|
specification_version: 4
|
350
349
|
summary: Turbo-charged counter caches for your Rails app.
|