Add support for specifying the serializer for an association as a String.

This enables the deferral of the resolution of the serializer class to prevent NameError exceptions due to reference cycles between serializer classes.
This commit is contained in:
Blake Watters
2012-11-30 17:26:35 -05:00
parent e79fe399a5
commit b0aced9ea2
2 changed files with 24 additions and 1 deletions

View File

@@ -39,7 +39,8 @@ module ActiveModel
end
def target_serializer
option(:serializer)
serializer = option(:serializer)
serializer.is_a?(String) ? serializer.constantize : serializer
end
def source_serializer