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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/grape_serializer.rb +5 -1
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 673094e6fb0ebafb53704d77262aac086b800ae8a9b904208ee6a943dd06442d
4
- data.tar.gz: 71e6e6176efa3475167bbc4614803c4eb91003bf79f5f09c8370ca4398b633e3
3
+ metadata.gz: 7c824e82b65e7a75c6e49b3030db849b5de1d8f76b8c13ffd27c824cfad28c43
4
+ data.tar.gz: 686c045c1d63d3e4f467c89e1d737d4b8ab4b2a7123d101d7739d2576708949b
5
5
  SHA512:
6
- metadata.gz: 313e827dd8d5473217d9ce6f10714eb15ff229d0d758c999d6835abfcde439a1b4f0c51e36e079742eedcccc152f41122059f444c8388415a40dbeda582640f2
7
- data.tar.gz: 625e4008b9edcbfa607c404baf36248bfb28159e48586e1bacd36aae4efc42bb845d45fe0e800e2293f24056c11628508fc8e7a09e54e5453bb2cf316c3ab897
6
+ metadata.gz: 3e3f62693aafcaf7a71c008fe725ce32c3a910441b8e68f3a1d5de2cd0501b191e06ddf83eb32a10e3c7f040240863d0ccffa9ea38d1e0032683791d216c7205
7
+ data.tar.gz: b13ef389568173507f30784300e82c0fcae3407ee4dd081d333072952c31eecbe51433ac3b1f11850094a1f270c4dfbbe8ac2a0c06c8575ccbfcb0ccc3826f38
@@ -24,7 +24,11 @@ class GrapeSerializer
24
24
  protected
25
25
 
26
26
  def preload_associations(resource)
27
- ActiveRecord::Associations::Preloader.new.preload(resource, association_array)
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.1.2
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-05-18 00:00:00.000000000 Z
11
+ date: 2023-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grape-entity