where_exists 3.2.0 → 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: d4749154c4976b45791c28a6e55d69016f57b09ccc47c0ada04d438d7851edf3
4
- data.tar.gz: 67112fa90f4536950ebad7cad399dd2c5ad5cd6c9effc8758c21c22f637c3ccf
3
+ metadata.gz: db3dd6dd4a33e68a26af47a8b84e8884096bed769f8155c5354614ddb67d3232
4
+ data.tar.gz: 8d79314ae2efc2240ea8ce2200e3562456119e03793d21690f7658234a420e22
5
5
  SHA512:
6
- metadata.gz: 8b57e52011f115272e0b13b0c24994ef0f3e7680082e57d3730712b73fd19e5ab36962e7a7b6d5b1a20b65bf316424d69da011cd0cf02b6576be6516fad09014
7
- data.tar.gz: db7a5a208d5af8b72d6e49c84198ea1a8ceebeeea1a975aa295ec876b7d1c3d19ef547141c028d6f62b0673eb80dc1dff3f23a8961541d2a233a95719f093a98
6
+ metadata.gz: a1a24d0ae23cdfbc98387db469d9becf4bbf8cf3c8771bfce09c9700fb1ac625060bd1e9787ff6816ad697f43c0876631f983fd18fc2903aa59312c489a9ca63
7
+ data.tar.gz: 863923df7462a279eec9009439006e88480fd2809be6df29fa79c2c04b1e5dac5b2ec19e511a2d60d46f297c2e5192c4cc11211cb0674e1141516beb062116b2
@@ -1,3 +1,3 @@
1
1
  module WhereExists
2
- VERSION = "3.2.0"
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.0
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-09-19 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
@@ -19,7 +18,7 @@ dependencies:
19
18
  version: '5.2'
20
19
  - - "<"
21
20
  - !ruby/object:Gem::Version
22
- version: '8.1'
21
+ version: '8.2'
23
22
  type: :runtime
24
23
  prerelease: false
25
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +28,7 @@ dependencies:
29
28
  version: '5.2'
30
29
  - - "<"
31
30
  - !ruby/object:Gem::Version
32
- version: '8.1'
31
+ version: '8.2'
33
32
  - !ruby/object:Gem::Dependency
34
33
  name: sqlite3
35
34
  requirement: !ruby/object:Gem::Requirement
@@ -114,7 +113,6 @@ files:
114
113
  - lib/where_exists/version.rb
115
114
  - test/belongs_to_polymorphic_test.rb
116
115
  - test/belongs_to_test.rb
117
- - test/db/test.db
118
116
  - test/documentation_test.rb
119
117
  - test/has_and_belongs_to_many.rb
120
118
  - test/has_many_polymorphic_test.rb
@@ -127,7 +125,6 @@ homepage: http://github.com/eugzol/where_exists
127
125
  licenses:
128
126
  - MIT
129
127
  metadata: {}
130
- post_install_message:
131
128
  rdoc_options: []
132
129
  require_paths:
133
130
  - lib
@@ -142,19 +139,17 @@ required_rubygems_version: !ruby/object:Gem::Requirement
142
139
  - !ruby/object:Gem::Version
143
140
  version: '0'
144
141
  requirements: []
145
- rubygems_version: 3.1.6
146
- signing_key:
142
+ rubygems_version: 4.0.3
147
143
  specification_version: 4
148
144
  summary: "#where_exists extension of ActiveRecord"
149
145
  test_files:
150
- - test/documentation_test.rb
151
- - test/has_many_through_conditions_test.rb
152
146
  - test/belongs_to_polymorphic_test.rb
153
147
  - test/belongs_to_test.rb
148
+ - test/documentation_test.rb
149
+ - test/has_and_belongs_to_many.rb
154
150
  - test/has_many_polymorphic_test.rb
155
- - test/db/test.db
151
+ - test/has_many_test.rb
152
+ - test/has_many_through_belongs_to_test.rb
153
+ - test/has_many_through_conditions_test.rb
156
154
  - test/has_many_through_test.rb
157
155
  - test/test_helper.rb
158
- - test/has_many_through_belongs_to_test.rb
159
- - test/has_and_belongs_to_many.rb
160
- - test/has_many_test.rb
data/test/db/test.db DELETED
Binary file