counter_culture 3.5.2 → 3.6.0

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: 9cb364451d9ed9870da702f56a916db61dd29792766ace4732eb915ef7e1d0fd
4
- data.tar.gz: 547fe6bfa9068ff65f5fa48a3afe1a847956ab04150a97f316f147c510c6bba3
3
+ metadata.gz: 5f4fd84b17129a9385e310381e0a19d5dc94a77f99bc6375e296cbf88c08fe72
4
+ data.tar.gz: a717e7ce645837b369e9fa5d40f7e721efaa8815b0ece0d814e124b798ede467
5
5
  SHA512:
6
- metadata.gz: 910b10128b0d1fab9145f12d77262cd007e0cfe3d6730d0d6e0606e4e4fa59de59822ad690211fe6563604bfdb7fe3f9d68cd10d9419c6b9b01c823f0eb6a307
7
- data.tar.gz: 611498966bc1a81b6177909ccae783cc9c4e598337aaeb02eb9db3586c06748ce02e555c6f357a5cb4c63a73fad902d52e321f9f0e8af6212c776c7d6a9a9150
6
+ metadata.gz: 74b120975400617101789ac7721b839e57e210e68a28d1edc307e2b8e03086e0d6adc652cb9a96be7cd0a7921c7e8033216316d63f0c74da9e3b929a9d24ad39
7
+ data.tar.gz: 050d42b195d1c947aa79f8cbbaf2dea74441020c67b96aa2493463c6cdcf0a1ccb649b7a322921174a64a30f4ba9287a0450ab217915dd62844adafdc5f934cd
data/Appraisals CHANGED
@@ -7,5 +7,8 @@
7
7
  ].each do |rails_version|
8
8
  appraise "rails-#{rails_version}" do
9
9
  gem 'rails', "~> #{rails_version}.0"
10
+ if Gem::Version.new(rails_version) < Gem::Version.new("7.2")
11
+ gem 'sqlite3', "~> 1.4"
12
+ end
10
13
  end
11
14
  end
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 3.6.0 (June 18, 2024)
2
+
3
+ Improvements:
4
+ - Don't perform a query if the `delta_magnitude` is zero (#394)
5
+
6
+ ## 3.5.3 (February 16, 2024)
7
+
8
+ Bugfixes:
9
+ - Correct polymorphic table name alias reference in join clauses (#388)
10
+
1
11
  ## 3.5.2 (January 16, 2024)
2
12
 
3
13
  Bugfixes:
@@ -43,7 +43,7 @@ Gem::Specification.new do |spec|
43
43
  spec.add_development_dependency 'rspec-extra-formatters'
44
44
  spec.add_development_dependency 'simplecov', '~> 0.16.1'
45
45
  spec.add_development_dependency 'timecop'
46
- spec.add_development_dependency 'sqlite3'
46
+ spec.add_development_dependency 'sqlite3', ">= 1.4"
47
47
  spec.add_development_dependency 'mysql2'
48
48
  spec.add_development_dependency 'pg'
49
49
  end
@@ -3,5 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "rails", "~> 5.2.0"
6
+ gem "sqlite3", "~> 1.4"
6
7
 
7
8
  gemspec path: "../"
@@ -3,5 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "rails", "~> 6.0.0"
6
+ gem "sqlite3", "~> 1.4"
6
7
 
7
8
  gemspec path: "../"
@@ -3,5 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "rails", "~> 6.1.0"
6
+ gem "sqlite3", "~> 1.4"
6
7
 
7
8
  gemspec path: "../"
@@ -3,5 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "rails", "~> 7.0.0"
6
+ gem "sqlite3", "~> 1.4"
6
7
 
7
8
  gemspec path: "../"
@@ -3,5 +3,6 @@
3
3
  source "https://rubygems.org"
4
4
 
5
5
  gem "rails", "~> 7.1.0"
6
+ gem "sqlite3", "~> 1.4"
6
7
 
7
8
  gemspec path: "../"
@@ -55,6 +55,8 @@ module CounterCulture
55
55
  else
56
56
  counter_delta_magnitude_for(obj)
57
57
  end
58
+ return if delta_magnitude.zero?
59
+
58
60
  # increment or decrement?
59
61
  operator = options[:increment] ? '+' : '-'
60
62
 
@@ -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.2'.freeze
2
+ VERSION = '3.6.0'.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.2
4
+ version: 3.6.0
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-16 00:00:00.000000000 Z
11
+ date: 2024-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -254,14 +254,14 @@ dependencies:
254
254
  requirements:
255
255
  - - ">="
256
256
  - !ruby/object:Gem::Version
257
- version: '0'
257
+ version: '1.4'
258
258
  type: :development
259
259
  prerelease: false
260
260
  version_requirements: !ruby/object:Gem::Requirement
261
261
  requirements:
262
262
  - - ">="
263
263
  - !ruby/object:Gem::Version
264
- version: '0'
264
+ version: '1.4'
265
265
  - !ruby/object:Gem::Dependency
266
266
  name: mysql2
267
267
  requirement: !ruby/object:Gem::Requirement
@@ -345,7 +345,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
345
345
  - !ruby/object:Gem::Version
346
346
  version: '0'
347
347
  requirements: []
348
- rubygems_version: 3.4.19
348
+ rubygems_version: 3.5.10
349
349
  signing_key:
350
350
  specification_version: 4
351
351
  summary: Turbo-charged counter caches for your Rails app.