mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
Merge pull request #639 from gauthier-delacroix/Unsuffixed-default-associations-keys
Allow JSONAPI unsuffixed associations keys
This commit is contained in:
@@ -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 = {})
|
||||
|
||||
Reference in New Issue
Block a user