rails_json_serializer 2.0.1 → 2.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/serializer/model_serializer.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4ed73e603bb8c02b8999399e76e1d3e359d502db69ede57a800229e1c9a12f9
|
4
|
+
data.tar.gz: 97cb1d7ac4a6b975d57f23406828783242121f0b3c63f57243e0ed125525733a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea0aa2817b2c46c27ff246d0b6e9df2bfbab06ad429d2e99a53f75bb258e81bb3cf9c5f27038992b0ff0037a270815fe9bde69524d3f7ed741bed7ca64f3138a
|
7
|
+
data.tar.gz: 721fefb41c3ed4892a0899f370eff95e2fdda0d77810137e379fcc1eed3241001c22bda2ebc232d321c99f365479f2757b959c2386febafba965b8d470281663
|
@@ -102,6 +102,11 @@ module ModelSerializer
|
|
102
102
|
|
103
103
|
|
104
104
|
klass.send(:define_method, :as_json) do |options = {}|
|
105
|
+
# We don't need to run this custom `as_json` multiple times, if defined on inherited class.
|
106
|
+
if options[:ran_serialization]
|
107
|
+
return super(options)
|
108
|
+
end
|
109
|
+
options[:ran_serialization] = true
|
105
110
|
# Not caching records that don't have IDs.
|
106
111
|
if !Serializer.configuration.disable_model_caching && self.id && options[:cache_key].present? && !(options.key?(:cache_for) && options[:cache_for].nil?)
|
107
112
|
cache_key = "#{self.class.name}_____#{options[:cache_key]}___#{self.id}"
|