mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-25 07:16:49 +00:00
test for namespaced associations + bug fixed
This commit is contained in:
@@ -38,8 +38,8 @@ module ActiveModel
|
||||
@embed_objects = embed == :object || embed == :objects
|
||||
end
|
||||
|
||||
def serializer_from_object(object)
|
||||
Serializer.serializer_for(object)
|
||||
def serializer_from_object(object, options = {})
|
||||
Serializer.serializer_for(object, options)
|
||||
end
|
||||
|
||||
def default_serializer
|
||||
@@ -47,7 +47,7 @@ module ActiveModel
|
||||
end
|
||||
|
||||
def build_serializer(object, options = {})
|
||||
serializer_class(object).new(object, options.merge(self.options))
|
||||
serializer_class(object, options).new(object, options.merge(self.options))
|
||||
end
|
||||
|
||||
class HasOne < Association
|
||||
@@ -57,8 +57,8 @@ module ActiveModel
|
||||
@key ||= "#{name}_id"
|
||||
end
|
||||
|
||||
def serializer_class(object)
|
||||
serializer_from_options || serializer_from_object(object) || default_serializer
|
||||
def serializer_class(object, options = {})
|
||||
serializer_from_options || serializer_from_object(object, options) || default_serializer
|
||||
end
|
||||
|
||||
def build_serializer(object, options = {})
|
||||
@@ -74,7 +74,7 @@ module ActiveModel
|
||||
@key ||= "#{name.to_s.singularize}_ids"
|
||||
end
|
||||
|
||||
def serializer_class(object)
|
||||
def serializer_class(object, _ = {})
|
||||
if use_array_serializer?
|
||||
ArraySerializer
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user