mirror of
https://github.com/ditkrg/active_model_serializers.git
synced 2026-01-23 06:16:50 +00:00
Associations doesn't depend on the source serializer anymore :)
This commit is contained in:
parent
c1e710aae1
commit
c04d452823
@ -218,7 +218,7 @@ module ActiveModel
|
||||
|
||||
associations = {}
|
||||
_associations.each do |attr, (association_class, options)|
|
||||
association = association_class.new(attr, self, options)
|
||||
association = association_class.new(attr, options)
|
||||
|
||||
if model_association = klass.reflect_on_association(association.name)
|
||||
# Real association.
|
||||
@ -381,7 +381,7 @@ module ActiveModel
|
||||
options[:embed] = _embed unless options.key?(:embed)
|
||||
options[:include] = _root_embed unless options.key?(:include)
|
||||
options[:serializer_options] = self.options
|
||||
association = association_class.new(name, self, options)
|
||||
association = association_class.new(name, options)
|
||||
|
||||
if association.embed_ids?
|
||||
node[association.key] =
|
||||
|
||||
@ -2,9 +2,8 @@ module ActiveModel
|
||||
class Serializer
|
||||
module Associations #:nodoc:
|
||||
class Config #:nodoc:
|
||||
def initialize(name, source, options={})
|
||||
def initialize(name, options={})
|
||||
@name = name
|
||||
@source = source
|
||||
@options = options
|
||||
end
|
||||
|
||||
@ -13,10 +12,6 @@ module ActiveModel
|
||||
serializer.is_a?(String) ? serializer.constantize : serializer
|
||||
end
|
||||
|
||||
def source_serializer
|
||||
@source
|
||||
end
|
||||
|
||||
def key
|
||||
options[:key] || @name
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user