version_serializers 0.1.2 → 0.1.3

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: e73b442e85a5f2b7970e4bfd427beae7fa131be1
4
- data.tar.gz: 5184c3ff3a81e67778e9b1f15b1fb56a8f2a564b
3
+ metadata.gz: 97eff7d7a40a5d6005542fe3647e2d0b7f8a8e26
4
+ data.tar.gz: 7bb2744f5b632b4d187fd924ac6d9c19189b5f07
5
5
  SHA512:
6
- metadata.gz: a0efc55afeadaca8ccbdf11b79c18b0985fbb47c188cc64688c1f6b6086784e2d30adaa26d5bc81588f775a43d72e0f706096047efea8146f490571e8c92c7fb
7
- data.tar.gz: e0483bee663dc4ee9558cf6ab5c6dad867ecc46d67ceaf9fe2c65f9d9bc51d66a7723cd0f3b69d9afc5cd83fcf50b3353faad5f4d653c2af06c1a310c2415ffd
6
+ metadata.gz: b500f7d48eafeed1ad7f0f6506099c31a16f8ad4de291d527be0b11f8e7ba8246172bdffb5bedb533a2d45ef21686442beb01b1de0fe57d1c87807d47d52beb9
7
+ data.tar.gz: f2770a88646b0cf16f8bfb2c295b7801c845e39a1ac9a4bd7a5d2c2081bfae46157ca24f2a7b19a79f0d539cbdc3229196d388b62793390a4e9eb35a48f00107
data/Gemfile.lock CHANGED
@@ -85,7 +85,7 @@ GIT
85
85
  PATH
86
86
  remote: .
87
87
  specs:
88
- version_serializers (0.1.2)
88
+ version_serializers (0.1.3)
89
89
  active_model_serializers (= 0.10.0.rc2)
90
90
 
91
91
  GEM
@@ -1,3 +1,3 @@
1
1
  module VersionSerializer
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -8,10 +8,14 @@ module VersionSerializer
8
8
  end
9
9
 
10
10
  def self.get_rendering_opts(resource, version, opts)
11
- resource_class_name = resource.class.to_s.split("::")[0]
11
+ resource_class_name = resource.class.to_s
12
+ serializer_key = :serializer
13
+ if resource.is_a?(ActiveRecord::Relation)
14
+ resource_class_name = resource_class_name.split("::").tap(&:pop).join("::")
15
+ serializer_key = :each_serializer
16
+ end
12
17
  serializer_class = get_serializer(resource_class_name, version)
13
- key = resource.is_a?(ActiveRecord::Relation) ? :each_serializer : :serializer
14
- opts.merge!(json: resource, key => serializer_class)
18
+ opts.merge!(json: resource, serializer_key => serializer_class)
15
19
  end
16
20
 
17
21
  def get
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: version_serializers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben D'Angelo
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-18 00:00:00.000000000 Z
11
+ date: 2016-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_model_serializers