Associations doesn't depend on the source serializer anymore :)

This commit is contained in:
Santiago Pastorino 2013-05-16 16:31:33 -07:00
parent c1e710aae1
commit c04d452823
2 changed files with 3 additions and 8 deletions

View File

@ -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] =

View File

@ -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