Add symbol support for ActiveModel::Serializer.type method

The ActiveModel::Serializer.type method now accepts symbol as paremeter:
class AuthorSerializer < ActiveModel::Serializer
  type :profile
end
The test file for the type was also refactored.
This commit is contained in:
Yohan Robert
2016-02-13 14:08:40 +01:00
committed by Yohan Robert
parent f02f0849b1
commit 727d7631ae
5 changed files with 83 additions and 73 deletions

View File

@@ -17,7 +17,7 @@ module ActiveModel
# class AdminAuthorSerializer < ActiveModel::Serializer
# type 'authors'
def type(type)
self._type = type
self._type = type && type.to_s
end
end
end