mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user