Add Serializer 'type' directive to control type field, for use by the JsonApi adapter

This commit is contained in:
Ivan Yurov
2015-10-01 22:48:57 -04:00
parent 1f08865a10
commit 2dd569ae51
3 changed files with 28 additions and 10 deletions

View File

@@ -71,6 +71,7 @@ module ActiveModel
end
def resource_identifier_type_for(serializer)
return serializer._type if serializer._type
if ActiveModel::Serializer.config.jsonapi_resource_type == :singular
serializer.object.class.model_name.singular
else