mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-22 22:06:50 +00:00
Allow JSONAPI unsuffixed associations keys
As shown here : https://github.com/json-api/json-api/blob/gh-pages/format/index.md#resource-relationships-
This commit is contained in:
parent
605408005f
commit
6f4f30cda6
@ -5,7 +5,11 @@ module ActiveModel
|
||||
def initialize(name, *args)
|
||||
super
|
||||
@root_key = @embedded_key
|
||||
@key ||= "#{name.to_s.singularize}_ids"
|
||||
@key ||= case CONFIG.default_key_type
|
||||
when :name then name.to_s.pluralize
|
||||
else "#{name.to_s.singularize}_ids"
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def serializer_class(object, _)
|
||||
|
||||
@ -5,7 +5,10 @@ module ActiveModel
|
||||
def initialize(name, *args)
|
||||
super
|
||||
@root_key = @embedded_key.to_s.pluralize
|
||||
@key ||= "#{name}_id"
|
||||
@key ||= case CONFIG.default_key_type
|
||||
when :name then name.to_s.singularize
|
||||
else "#{name}_id"
|
||||
end
|
||||
end
|
||||
|
||||
def serializer_class(object, options = {})
|
||||
|
||||
Loading…
Reference in New Issue
Block a user