activerecord_where_assoc 1.3.0 → 1.4.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c25ebdab306cdfa08879b9237211c464b023ab1445e2607ae18855b8546730bf
4
- data.tar.gz: 76d893474ad646ab75258ab6856050193cd7bd17ccacef8a28fc7dc9e7c2de04
3
+ metadata.gz: 768373344f780ec8191777dfc7dad5f656ab9e4707db1939c00476d1b0164696
4
+ data.tar.gz: 7696b9e535fbf9058aaa73d7d1ad851f3c73ecf9141e8564cae5100d2c334fe3
5
5
  SHA512:
6
- metadata.gz: 110b91b46d60a9dbe82d31784e743e5f4d3cd4d67e3389593c97cd7461d17977e5ba941b265a7d30e04a8455d8c090f86c4ed54be87282d114ac6fa6fe712934
7
- data.tar.gz: 14b76e774b2731063a10eaeb4654497c53521d44935172858697e7e9337e9e2032ba742c81e41bb48f925c305c53fd414d5e30817740766570ef60ee9a4853f0
6
+ metadata.gz: 1c269abd34e7d5228f74ee59126d1de36875649bda2d7993b76632fa71d7a709f98deecc83996449a599e7fb66313d940d5a32ab2cd33488d4eebaa13cae2360
7
+ data.tar.gz: e41c23e84ef3c721a9bc72c2a42b94bd08bb68a1aa47e23f67c810aa3298b7dc7da3fdbc414408640451db904f082b869052a63343ba12c3a710d36c1e521560
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Unreleased
2
2
 
3
+ # 1.4.0 - 2026-04-14
4
+
5
+ * Add support for extensions on `has_many` and `has_and_belongs_to_many` associations in Rails 5.0 and above
6
+
3
7
  # 1.3.0 - 2025-03-04
4
8
 
5
9
  * The arguments of `#where_assoc_count` can now be swapped when comparing to a number or a range. <br>
data/README.md CHANGED
@@ -1,7 +1,6 @@
1
1
  # ActiveRecord Where Assoc
2
2
 
3
3
  ![Test supported versions](https://github.com/MaxLap/activerecord_where_assoc/workflows/Test%20supported%20versions/badge.svg)
4
- [![Code Climate](https://codeclimate.com/github/MaxLap/activerecord_where_assoc/badges/gpa.svg)](https://codeclimate.com/github/MaxLap/activerecord_where_assoc)
5
4
 
6
5
  This gem makes it easy to do conditions based on the associations of your records in ActiveRecord (Rails). (Using SQL's `EXISTS` operator)
7
6
 
@@ -37,7 +36,7 @@ These methods have many advantages over the alternative ways of achieving the si
37
36
 
38
37
  ## Installation
39
38
 
40
- Rails 4.1 to 7.0 are supported with Ruby 2.1 to 3.1. Tested against SQLite3, PostgreSQL and MySQL. The gem
39
+ Rails 4.1 to 8.1 are supported with Ruby 2.1 to 4.0. Tested against SQLite3, PostgreSQL and MySQL. The gem
41
40
  only depends on the `activerecord` gem.
42
41
 
43
42
  Add this line to your application's Gemfile:
@@ -54,6 +53,14 @@ Or install it yourself with:
54
53
 
55
54
  $ gem install activerecord_where_assoc
56
55
 
56
+ ## Sqlite issue
57
+
58
+ If used with SQLite, note that there is a problem related to nested EXISTS in SQLite 3.51.0 (contained in the [sqlite3 gem version 2.8.0](https://rubygems.org/gems/sqlite3/versions/2.8.0)) and SQLite 3.51.1 (in 2.8.1 and 2.9.0). It is recommended to avoid the problematic versions with:
59
+
60
+ ```ruby
61
+ gem 'sqlite3', '!= 2.8.0', '!= 2.8.1', '!= 2.9.0'
62
+ ```
63
+
57
64
  ## Development state
58
65
 
59
66
  This gem is feature complete and production ready.<br>
@@ -61,6 +61,16 @@ module ActiveRecordWhereAssoc
61
61
  end
62
62
  end
63
63
 
64
+ if ActiveRecord.gem_version >= Gem::Version.new("5.0")
65
+ def self.reflection_extensions(reflection)
66
+ reflection.extensions
67
+ end
68
+ else
69
+ def self.reflection_extensions(reflection)
70
+ []
71
+ end
72
+ end
73
+
64
74
  if ActiveRecord.gem_version >= Gem::Version.new("5.0")
65
75
  def self.parent_reflection(reflection)
66
76
  reflection.parent_reflection
@@ -206,7 +206,11 @@ module ActiveRecordWhereAssoc
206
206
  current_scope = current_scope.where(klass_scope)
207
207
  end
208
208
  end
209
- current_scope = apply_proc_scope(current_scope, last_assoc_block) if last_assoc_block
209
+ if last_assoc_block
210
+ extensions = ActiveRecordCompat.reflection_extensions(final_reflection)
211
+ current_scope = current_scope.extending(*extensions) if extensions.any?
212
+ current_scope = apply_proc_scope(current_scope, last_assoc_block)
213
+ end
210
214
  else
211
215
  current_scope = process_association_step_limits(current_scope, reflection, record_class, options)
212
216
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActiveRecordWhereAssoc
4
- VERSION = "1.3.0".freeze
4
+ VERSION = "1.4.0".freeze
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord_where_assoc
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxime Handfield Lapointe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-03-04 00:00:00.000000000 Z
11
+ date: 2026-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord