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:
Kevin Bullaughey
2014-09-21 07:52:17 -04:00
parent 34d684ee9a
commit edfd38bdee
5 changed files with 25 additions and 26 deletions

View File

@@ -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