Add test cases for nil polymorphic associations

This commit is contained in:
adman65
2012-01-03 13:37:39 +02:00
parent 54d3f2edf0
commit 09bb41fbdb
2 changed files with 42 additions and 1 deletions

View File

@@ -131,10 +131,12 @@ module ActiveModel
def serialize_ids(object, scope)
if polymorphic?
if polymorphic? && object
{
polymorphic_key(object) => object.read_attribute_for_serialization(:id),
}
elsif polymorphic? && !object
{ }
elsif object
{ key => object.read_attribute_for_serialization(:id) }
else