mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
converted has many to use string key for association, makeing it compatable with has_one; fixed tests that relied on symbol keys for has_many associations
This commit is contained in:
@@ -4,12 +4,11 @@ module ActiveModel
|
||||
class HasMany < Association
|
||||
def initialize(name, *args)
|
||||
super
|
||||
@root_key = @embedded_key
|
||||
@root_key = @embedded_key.to_s
|
||||
@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, _)
|
||||
@@ -37,4 +36,4 @@ module ActiveModel
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user