auto_preload 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +17 -0
- data/lib/auto_preload/active_record.rb +6 -3
- data/lib/auto_preload/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b400e79944285da53bdd3246948248bdef10323e536761b38794fa7c774a085
|
4
|
+
data.tar.gz: 222fcad81c801c6f33f1ae91e005b6402f87549b30e4f62d5e587b800e888f2d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46b10d83dde0c430ff36e0a4a0ac49daab14426240c696a396e7687e762ebed642a06a7a0a97feb08707552f6723174837a99c36bcfb29b92206f262f9c45afe
|
7
|
+
data.tar.gz: 294bd08145cd0712de2899c2366b7e8c6783292cb837a1b397502410965cdb501e2c53198dcbd0a5814caecee87821be5d7b3cee9661193f0fc1cae3cca33e4a
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [0.1.1] - 2022-11-30
|
9
|
+
|
10
|
+
### Fixed
|
11
|
+
- Prevent crash when passing a non-existing association
|
12
|
+
|
13
|
+
## [0.1.0] - 2022-11-30
|
14
|
+
|
15
|
+
### Added
|
16
|
+
|
17
|
+
- First release
|
@@ -7,21 +7,24 @@ module AutoPreload
|
|
7
7
|
included do
|
8
8
|
scope :auto_includes, lambda { |inclusions, options = {}|
|
9
9
|
if inclusions.present?
|
10
|
-
|
10
|
+
resolved = Resolver.new(options).resolve(self, inclusions)
|
11
|
+
resolved.empty? ? self : includes(*resolved)
|
11
12
|
else
|
12
13
|
self
|
13
14
|
end
|
14
15
|
}
|
15
16
|
scope :auto_preload, lambda { |inclusions, options = {}|
|
16
17
|
if inclusions.present?
|
17
|
-
|
18
|
+
resolved = Resolver.new(options).resolve(self, inclusions)
|
19
|
+
resolved.empty? ? self : preload(*resolved)
|
18
20
|
else
|
19
21
|
self
|
20
22
|
end
|
21
23
|
}
|
22
24
|
scope :auto_eager_load, lambda { |inclusions, options = {}|
|
23
25
|
if inclusions.present?
|
24
|
-
|
26
|
+
resolved = Resolver.new(options).resolve(self, inclusions)
|
27
|
+
resolved.empty? ? self : eager_load(*resolved)
|
25
28
|
else
|
26
29
|
self
|
27
30
|
end
|
data/lib/auto_preload/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: auto_preload
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mònade
|
@@ -64,6 +64,7 @@ files:
|
|
64
64
|
- ".gitignore"
|
65
65
|
- ".rspec"
|
66
66
|
- ".rubocop.yml"
|
67
|
+
- CHANGELOG.md
|
67
68
|
- Gemfile
|
68
69
|
- LICENSE
|
69
70
|
- README.md
|