grape_serializer 0.1.2 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/grape_serializer.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c824e82b65e7a75c6e49b3030db849b5de1d8f76b8c13ffd27c824cfad28c43
|
4
|
+
data.tar.gz: 686c045c1d63d3e4f467c89e1d737d4b8ab4b2a7123d101d7739d2576708949b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e3f62693aafcaf7a71c008fe725ce32c3a910441b8e68f3a1d5de2cd0501b191e06ddf83eb32a10e3c7f040240863d0ccffa9ea38d1e0032683791d216c7205
|
7
|
+
data.tar.gz: b13ef389568173507f30784300e82c0fcae3407ee4dd081d333072952c31eecbe51433ac3b1f11850094a1f270c4dfbbe8ac2a0c06c8575ccbfcb0ccc3826f38
|
data/lib/grape_serializer.rb
CHANGED
@@ -24,7 +24,11 @@ class GrapeSerializer
|
|
24
24
|
protected
|
25
25
|
|
26
26
|
def preload_associations(resource)
|
27
|
-
|
27
|
+
if Rails::VERSION::MAJOR >= 7
|
28
|
+
ActiveRecord::Associations::Preloader.new(records: [resource].flatten, associations: association_array).call
|
29
|
+
else
|
30
|
+
ActiveRecord::Associations::Preloader.new.preload(resource, association_array)
|
31
|
+
end
|
28
32
|
end
|
29
33
|
|
30
34
|
def association_array
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grape_serializer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- JiaRou Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: grape-entity
|