goldiloader 4.2.0 → 4.2.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: 60dd6e4947b269049f3a3348487771468d5dd5d9dc3a1029022ddbe88cc8ec37
4
- data.tar.gz: 4b064ab04a026f86e68cda4d196b128b175b4fa85ce16c2bcc6026a87f52aa62
3
+ metadata.gz: 4dad32fcba65c9784b6f3b21e8f477055d6511714173f0fe34ea9c61a7bb79b6
4
+ data.tar.gz: 8bf99537c6f893ebc042a416f4f77b522c854efc9250e89b45d0cda39099693f
5
5
  SHA512:
6
- metadata.gz: 7da14e3c1d7c8c2ce7d824bb3af676b7edd0dd5399889242c3cab874d26e957b8d9a3bcd6b2f29a6fb0aa88498d447538e1a5620f691a38b1dfa78b69dd6837a
7
- data.tar.gz: a124830cd0f6a34def8d4d59daabce9889d89da6840eeb5adff5b4f6266b159cb2b785c949c31a6f96d407319fdee3b777d96ddaba1b26e04094dc8e843dd642
6
+ metadata.gz: 411a75dea6931ffd45c3883cb6a8bffd6e5e69a7960763faea39bbb1deebe7ec8af961b0acc7c19dff01574b0507678d0359b19d88cbd50aa3bdaf98fb0bc05a
7
+ data.tar.gz: 67b0d0addd6bdef131cc8f5d0bad6f398653a61cdb91d7d3e18c8ef8b24bb91fac74c7c0d12e2755a87998e2e49ce55daa254671b8afd2c1a57e8611189caae0
@@ -173,7 +173,20 @@ module Goldiloader
173
173
  def auto_include?
174
174
  # Only auto include through associations if the target association is auto-loadable
175
175
  through_association = owner.association(through_reflection.name)
176
- through_association.auto_include? && super
176
+ auto_include_self = super
177
+
178
+ # If the current association cannot be auto-included there is nothing we can do
179
+ return false unless auto_include_self
180
+
181
+ # If the through association can just be auto-included we're good
182
+ return true if through_association.auto_include?
183
+
184
+ # If the through association was already loaded and does not contain new, changed, or destroyed records
185
+ # we are also able to auto-include the association. It means it has only already been read or changes are
186
+ # already persisted.
187
+ through_association.loaded? && Array.wrap(through_association.target).none? do |record|
188
+ record.new_record? || record.changed? || record.destroyed?
189
+ end
177
190
  end
178
191
  end
179
192
  ::ActiveRecord::Associations::HasManyThroughAssociation.prepend(::Goldiloader::ThroughAssociationPatch)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Goldiloader
4
- VERSION = '4.2.0'
4
+ VERSION = '4.2.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goldiloader
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.0
4
+ version: 4.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joel Turkel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-01-14 00:00:00.000000000 Z
11
+ date: 2024-05-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -51,27 +51,21 @@ dependencies:
51
51
  - !ruby/object:Gem::Version
52
52
  version: '7.2'
53
53
  - !ruby/object:Gem::Dependency
54
- name: activestorage
54
+ name: appraisal
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - ">="
58
58
  - !ruby/object:Gem::Version
59
- version: '5.2'
60
- - - "<"
61
- - !ruby/object:Gem::Version
62
- version: '7.2'
59
+ version: '0'
63
60
  type: :development
64
61
  prerelease: false
65
62
  version_requirements: !ruby/object:Gem::Requirement
66
63
  requirements:
67
64
  - - ">="
68
65
  - !ruby/object:Gem::Version
69
- version: '5.2'
70
- - - "<"
71
- - !ruby/object:Gem::Version
72
- version: '7.2'
66
+ version: '0'
73
67
  - !ruby/object:Gem::Dependency
74
- name: appraisal
68
+ name: benchmark-ips
75
69
  requirement: !ruby/object:Gem::Requirement
76
70
  requirements:
77
71
  - - ">="
@@ -85,19 +79,19 @@ dependencies:
85
79
  - !ruby/object:Gem::Version
86
80
  version: '0'
87
81
  - !ruby/object:Gem::Dependency
88
- name: benchmark-ips
82
+ name: combustion
89
83
  requirement: !ruby/object:Gem::Requirement
90
84
  requirements:
91
- - - ">="
85
+ - - "~>"
92
86
  - !ruby/object:Gem::Version
93
- version: '0'
87
+ version: '1.3'
94
88
  type: :development
95
89
  prerelease: false
96
90
  version_requirements: !ruby/object:Gem::Requirement
97
91
  requirements:
98
- - - ">="
92
+ - - "~>"
99
93
  - !ruby/object:Gem::Version
100
- version: '0'
94
+ version: '1.3'
101
95
  - !ruby/object:Gem::Dependency
102
96
  name: coveralls_reborn
103
97
  requirement: !ruby/object:Gem::Requirement
@@ -113,21 +107,27 @@ dependencies:
113
107
  - !ruby/object:Gem::Version
114
108
  version: 0.18.0
115
109
  - !ruby/object:Gem::Dependency
116
- name: database_cleaner
110
+ name: rails
117
111
  requirement: !ruby/object:Gem::Requirement
118
112
  requirements:
119
113
  - - ">="
120
114
  - !ruby/object:Gem::Version
121
- version: '1.2'
115
+ version: '5.2'
116
+ - - "<"
117
+ - !ruby/object:Gem::Version
118
+ version: '7.2'
122
119
  type: :development
123
120
  prerelease: false
124
121
  version_requirements: !ruby/object:Gem::Requirement
125
122
  requirements:
126
123
  - - ">="
127
124
  - !ruby/object:Gem::Version
128
- version: '1.2'
125
+ version: '5.2'
126
+ - - "<"
127
+ - !ruby/object:Gem::Version
128
+ version: '7.2'
129
129
  - !ruby/object:Gem::Dependency
130
- name: mime-types
130
+ name: rake
131
131
  requirement: !ruby/object:Gem::Requirement
132
132
  requirements:
133
133
  - - ">="
@@ -141,35 +141,35 @@ dependencies:
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0'
143
143
  - !ruby/object:Gem::Dependency
144
- name: rake
144
+ name: rspec
145
145
  requirement: !ruby/object:Gem::Requirement
146
146
  requirements:
147
- - - ">="
147
+ - - "~>"
148
148
  - !ruby/object:Gem::Version
149
- version: '0'
149
+ version: '3'
150
150
  type: :development
151
151
  prerelease: false
152
152
  version_requirements: !ruby/object:Gem::Requirement
153
153
  requirements:
154
- - - ">="
154
+ - - "~>"
155
155
  - !ruby/object:Gem::Version
156
- version: '0'
156
+ version: '3'
157
157
  - !ruby/object:Gem::Dependency
158
- name: rspec
158
+ name: rspec_junit_formatter
159
159
  requirement: !ruby/object:Gem::Requirement
160
160
  requirements:
161
- - - "~>"
161
+ - - ">="
162
162
  - !ruby/object:Gem::Version
163
- version: '3'
163
+ version: '0'
164
164
  type: :development
165
165
  prerelease: false
166
166
  version_requirements: !ruby/object:Gem::Requirement
167
167
  requirements:
168
- - - "~>"
168
+ - - ">="
169
169
  - !ruby/object:Gem::Version
170
- version: '3'
170
+ version: '0'
171
171
  - !ruby/object:Gem::Dependency
172
- name: rspec_junit_formatter
172
+ name: rspec-rails
173
173
  requirement: !ruby/object:Gem::Requirement
174
174
  requirements:
175
175
  - - ">="
@@ -214,16 +214,16 @@ dependencies:
214
214
  name: sqlite3
215
215
  requirement: !ruby/object:Gem::Requirement
216
216
  requirements:
217
- - - "~>"
217
+ - - ">="
218
218
  - !ruby/object:Gem::Version
219
- version: '1.3'
219
+ version: '0'
220
220
  type: :development
221
221
  prerelease: false
222
222
  version_requirements: !ruby/object:Gem::Requirement
223
223
  requirements:
224
- - - "~>"
224
+ - - ">="
225
225
  - !ruby/object:Gem::Version
226
- version: '1.3'
226
+ version: '0'
227
227
  description: Automatically eager loads Rails associations as associations are traversed
228
228
  email:
229
229
  - jturkel@salsify.com
@@ -265,7 +265,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
265
265
  - !ruby/object:Gem::Version
266
266
  version: '0'
267
267
  requirements: []
268
- rubygems_version: 3.2.22
268
+ rubygems_version: 3.3.26
269
269
  signing_key:
270
270
  specification_version: 4
271
271
  summary: Automatic Rails association eager loading