scoped_serializer 1.0.0.b → 1.0.0

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: 0e9612c4d1cdb699e0f40eb48488a7070c2c0061
4
- data.tar.gz: 81cba16a43b750cc6cb0f0a5d430f6f7ac9dcb09
3
+ metadata.gz: bac41027d295a52498d1966920f57e030b78c547
4
+ data.tar.gz: e497b8660c9951ea614f2b8c97d2692b92977bc3
5
5
  SHA512:
6
- metadata.gz: 7d1b6de7261469f277e6f68b18317b57d6e5f7a769d54f12043ee746131d46cbb5bb6d4ca08c64edf697ef44a830be0a570d0949729bad0c3692a7a16c8c35fa
7
- data.tar.gz: 75f0c405ffcb113f1ad0a8ccfc05f24b4393023d40de02485b22f5ae3f7349a5e1706dfc001ba5415df7851013bfa553fc2f4661833f10a513ee7561235a746b
6
+ metadata.gz: ed509d7a7c1e4fc986da5420865be2386724ed6ee3643c9c0e4c3c76502e99c49c1c7e87bee3a672d0eb1e18fface9be124a41d2fde1f799dbb716df16747b19
7
+ data.tar.gz: 82f0ea3dcf619cb739f93bff8d8385459563b32b705769bc8e18f472b915a55e5eaf32f24bff6d347cf86a5dc77c6816251c4f02ae59795bb9e87fb191f9eeb6
@@ -91,6 +91,8 @@ module ScopedSerializer
91
91
  end
92
92
 
93
93
  def find_serializer_by_class(object_class)
94
+ return object_class.serializer_class if object_class.respond_to?(:serializer_class)
95
+
94
96
  "#{object_class.name}Serializer".safe_constantize
95
97
  end
96
98
 
@@ -23,7 +23,13 @@ module ScopedSerializer
23
23
  # default_root_key(User) # => 'user'
24
24
  #
25
25
  def default_root_key(object_class)
26
- if object_class.respond_to?(:model_name)
26
+ if (serializer = ScopedSerializer.find_serializer_by_class(object_class))
27
+ root_key = serializer.find_scope(:default).options[:root]
28
+ end
29
+
30
+ if root_key
31
+ root_key.to_s
32
+ elsif object_class.respond_to?(:model_name)
27
33
  object_class.model_name.element
28
34
  else
29
35
  object_class.name
@@ -1,3 +1,3 @@
1
1
  module ScopedSerializer
2
- VERSION = "1.0.0.b"
2
+ VERSION = "1.0.0"
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.b
4
+ version: 1.0.0
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-02-18 00:00:00.000000000 Z
11
+ date: 2015-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -184,9 +184,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
184
184
  version: '0'
185
185
  required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  requirements:
187
- - - ">"
187
+ - - ">="
188
188
  - !ruby/object:Gem::Version
189
- version: 1.3.1
189
+ version: '0'
190
190
  requirements: []
191
191
  rubyforge_project:
192
192
  rubygems_version: 2.4.5