where_exists 3.2.1 → 3.3.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: 7418a9047cf21e0b2ba7704220f6102c3e2c830096e6885a3c163ca66107af2f
4
- data.tar.gz: 6c4d58b3e9bf1090ab6c6a6f1e6c5c3924157e0b86cee6072c85f90c4bae4ba6
3
+ metadata.gz: db3dd6dd4a33e68a26af47a8b84e8884096bed769f8155c5354614ddb67d3232
4
+ data.tar.gz: 8d79314ae2efc2240ea8ce2200e3562456119e03793d21690f7658234a420e22
5
5
  SHA512:
6
- metadata.gz: 6f9d348e8bed4be3c46d0c1d01b1dc4104349b2e09a2b2a8674c15b41493d3e456049834770b36a8a2ba0c77a0845fc53ce95d840e462db459ae7f09e08c7318
7
- data.tar.gz: f06abf232e76ee00b2e3f048e41285168fffbeb34106713bc358d349a306576b0e3ad671c32fcbb8f23bcb39522e399b96737e4b7233d179e0789096097d27de
6
+ metadata.gz: a1a24d0ae23cdfbc98387db469d9becf4bbf8cf3c8771bfce09c9700fb1ac625060bd1e9787ff6816ad697f43c0876631f983fd18fc2903aa59312c489a9ca63
7
+ data.tar.gz: 863923df7462a279eec9009439006e88480fd2809be6df29fa79c2c04b1e5dac5b2ec19e511a2d60d46f297c2e5192c4cc11211cb0674e1141516beb062116b2
@@ -1,3 +1,3 @@
1
1
  module WhereExists
2
- VERSION = "3.2.1"
2
+ VERSION = "3.3.0"
3
3
  end
data/lib/where_exists.rb CHANGED
@@ -163,6 +163,10 @@ module WhereExists
163
163
  result = result.where(*where_parameters)
164
164
  end
165
165
 
166
+ if (association.extensions.any?)
167
+ result.extending!(association.extensions)
168
+ end
169
+
166
170
  result = yield result if block_given?
167
171
  [result]
168
172
  end
@@ -13,7 +13,11 @@ end
13
13
 
14
14
  class SimpleEntity < ActiveRecord::Base
15
15
  has_many :simple_entity_children, primary_key: :my_id, foreign_key: :parent_id
16
- has_many :unnamed_children, -> { where name: nil }, primary_key: :my_id, foreign_key: :parent_id, class_name: 'SimpleEntityChild'
16
+ has_many :unnamed_children, -> { where name: nil }, primary_key: :my_id, foreign_key: :parent_id, class_name: 'SimpleEntityChild' do
17
+ def unborn
18
+ where('my_date < ?', Time.now)
19
+ end
20
+ end
17
21
  end
18
22
 
19
23
  class SimpleEntityChild < ActiveRecord::Base
@@ -61,6 +65,16 @@ class HasManyTest < Minitest::Test
61
65
  assert_equal result.first.id, entity.id
62
66
  end
63
67
 
68
+ def test_with_association_extension_scope
69
+ child = SimpleEntityChild.create!(my_date: Time.now - 1.minute)
70
+ entity = SimpleEntity.create!(simple_entity_children: [child], my_id: 999)
71
+
72
+ result = SimpleEntity.where_exists(:unnamed_children, &:unborn)
73
+
74
+ assert_equal 1, result.length
75
+ assert_equal result.first.id, entity.id
76
+ end
77
+
64
78
  def test_with_condition
65
79
  child_1 = SimpleEntityChild.create! name: nil
66
80
  child_2 = SimpleEntityChild.create! name: 'Luke'
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: where_exists
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eugene Zolotarev
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-11-20 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: activerecord
@@ -126,7 +125,6 @@ homepage: http://github.com/eugzol/where_exists
126
125
  licenses:
127
126
  - MIT
128
127
  metadata: {}
129
- post_install_message:
130
128
  rdoc_options: []
131
129
  require_paths:
132
130
  - lib
@@ -141,8 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
139
  - !ruby/object:Gem::Version
142
140
  version: '0'
143
141
  requirements: []
144
- rubygems_version: 3.5.20
145
- signing_key:
142
+ rubygems_version: 4.0.3
146
143
  specification_version: 4
147
144
  summary: "#where_exists extension of ActiveRecord"
148
145
  test_files: