Merge pull request #813 from jtomaszewski/feature/custom-serializer-class

Allow to define custom serializer for given class
This commit is contained in:
Alexandre de Oliveira
2015-03-09 11:43:53 -03:00
2 changed files with 20 additions and 1 deletions

View File

@@ -56,7 +56,9 @@ end
attr_reader :key_format
def serializer_for(resource, options = {})
if resource.respond_to?(:to_ary)
if resource.respond_to?(:serializer_class)
resource.serializer_class
elsif resource.respond_to?(:to_ary)
if Object.constants.include?(:ArraySerializer)
::ArraySerializer
else