scoped_serializer 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 68d1d14432e7ba33ed7f794ee9a9d37a74404e43
|
4
|
+
data.tar.gz: f26d981f83d3028c879021e93fbe3083da6fa4ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e9822c56d6644e6975872262f69bf1cd9d14a7b86b93ac93dedbe258cdc44cd1793ff31d28bd0573befaf23683f40d8871356c07bf50b1e8bb3b074558e7009e
|
7
|
+
data.tar.gz: de934c5af2199e936bf0e58868530f26543d41122d8b1ef5f2590342e8fc0eff4e047aac2975b37fc5ade48354d0ec18fc1e179cd9207469b53c4acb1efcee68
|
@@ -6,6 +6,7 @@ module ScopedSerializer
|
|
6
6
|
def initialize(array, options={})
|
7
7
|
@array = array
|
8
8
|
@options = options || {}
|
9
|
+
@options[:each_serializer] ||= @options.delete(:serializer)
|
9
10
|
end
|
10
11
|
|
11
12
|
def serializable_hash(options={})
|
@@ -41,7 +42,7 @@ module ScopedSerializer
|
|
41
42
|
|
42
43
|
def serializable_objects
|
43
44
|
@serializable_objects ||= array.collect do |object|
|
44
|
-
ScopedSerializer.for(object, @options.merge(:root => false))
|
45
|
+
ScopedSerializer.for(object, @options.merge(:root => false, :serializer => @options[:each_serializer]))
|
45
46
|
end
|
46
47
|
end
|
47
48
|
|
@@ -142,10 +142,10 @@ module ScopedSerializer
|
|
142
142
|
includes = options[:preload] == true ? options[:include] : options[:preload]
|
143
143
|
end
|
144
144
|
|
145
|
-
object
|
146
|
-
|
147
|
-
|
148
|
-
|
145
|
+
if (object = fetch_association(association_data, includes))
|
146
|
+
data = ScopedSerializer.for(object, options.merge(:associations => options[:include])).as_json
|
147
|
+
hash.merge!(data) if data
|
148
|
+
end
|
149
149
|
end
|
150
150
|
|
151
151
|
hash
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scoped_serializer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arjen Oosterkamp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2017-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|