mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 15:23:06 +00:00
Serialize associations that doesn't have an associated serializer
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
require 'active_model/default_serializer'
|
||||
require 'active_model/serializer'
|
||||
|
||||
module ActiveModel
|
||||
@@ -32,13 +33,8 @@ module ActiveModel
|
||||
end
|
||||
|
||||
def build_serializer(object)
|
||||
@serializer_class ||= Serializer.serializer_for(object)
|
||||
|
||||
if @serializer_class
|
||||
@serializer_class.new(object, @options)
|
||||
else
|
||||
object
|
||||
end
|
||||
@serializer_class ||= Serializer.serializer_for(object) || DefaultSerializer
|
||||
@serializer_class.new(object, @options)
|
||||
end
|
||||
|
||||
class HasOne < Association
|
||||
|
||||
Reference in New Issue
Block a user