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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ab4a286fa35aeed4f39a89653ed55be5da8c2ea6255a84f8f5c60c3002a4e75
4
- data.tar.gz: 910213339a5c0815679736c77e72b8964a678fb58495fdfd9882157b3fdaaf5b
3
+ metadata.gz: ce78ea0f9a3ad552e5cb8b0e230dbc70fc3fcb51f9f0c21676c3ecca7601569a
4
+ data.tar.gz: 840001761832861fbbef2e3d921d553d0ea39c685a8ab16b4096444722bb5d03
5
5
  SHA512:
6
- metadata.gz: d42e4460ea4ad61e3ee12bdc430d9cb833772a32d02bdfe9c2fd8b78f7f06d157f06e9f50dec1efb5df6bf6c917b624f4c9c626ac43ea541a9faef3422fbc5b8
7
- data.tar.gz: 50166340b9db761bcdf4a198d21d8c1580b26d09cf4928082885175441ef260758d909e321d30c7204e2f782730833e8153db8a3d28c879dd55d8de3d2ceb453
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
@@ -1,3 +1,8 @@
1
+ ## 3.3.1 (June 26, 2023)
2
+
3
+ Bugfixes:
4
+ - Read primary key on polymorphic associations if it's explicitly set (#370)
5
+
1
6
  ## 3.3.0 (October 11, 2022)
2
7
 
3
8
  Improvements:
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.0, 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 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
  ```
@@ -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 = Gem::Requirement.new('>= 2.3.0')
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)
@@ -1,3 +1,3 @@
1
1
  module CounterCulture
2
- VERSION = '3.3.0'.freeze
2
+ VERSION = '3.3.1'.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.3.0
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: 2022-10-12 00:00:00.000000000 Z
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.3.0
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.3.7
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.
data/circle.yml DELETED
@@ -1,12 +0,0 @@
1
- machine:
2
- ruby:
3
- version: 2.3.1
4
- database:
5
- override:
6
- - echo "No database setup required..."
7
- dependencies:
8
- post:
9
- - cd spec/rails_app && bundle install
10
- test:
11
- override:
12
- - bundle exec rspec spec