scoped_serializer 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bac41027d295a52498d1966920f57e030b78c547
4
- data.tar.gz: e497b8660c9951ea614f2b8c97d2692b92977bc3
3
+ metadata.gz: 68d1d14432e7ba33ed7f794ee9a9d37a74404e43
4
+ data.tar.gz: f26d981f83d3028c879021e93fbe3083da6fa4ce
5
5
  SHA512:
6
- metadata.gz: ed509d7a7c1e4fc986da5420865be2386724ed6ee3643c9c0e4c3c76502e99c49c1c7e87bee3a672d0eb1e18fface9be124a41d2fde1f799dbb716df16747b19
7
- data.tar.gz: 82f0ea3dcf619cb739f93bff8d8385459563b32b705769bc8e18f472b915a55e5eaf32f24bff6d347cf86a5dc77c6816251c4f02ae59795bb9e87fb191f9eeb6
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 = fetch_association(association_data, includes)
146
- data = ScopedSerializer.for(object, options.merge(:associations => options[:include])).as_json
147
-
148
- hash.merge!(data) if data
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
@@ -1,3 +1,3 @@
1
1
  module ScopedSerializer
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
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.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: 2015-05-28 00:00:00.000000000 Z
11
+ date: 2017-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails