class ActiveModel::Serializer

def include!(name, options={})

def include!(name, options={})
  # Make sure that if a special options[:hash] was passed in, we generate
  # a new unique values hash and don't clobber the original. If the hash
  # passed in is the same as the current options hash, use the current
  # unique values.
  #
  # TODO: Should passing in a Hash even be public API here?
  unique_values =
    if hash = options[:hash]
      if @options[:hash] == hash
        @options[:unique_values] ||= {}
      else
        {}
      end
    else
      hash = @options[:hash]
      @options[:unique_values] ||= {}
    end
  node = options[:node]
  value = options[:value]
  association_class =
    if klass = _associations[name]
      klass
    elsif value.respond_to?(:to_ary)
      Associations::HasMany
    else
      Associations::HasOne
    end
  association = association_class.new(name, self, options)
  if association.embed_ids?
    node[association.key] = association.serialize_ids
    if association.embed_in_root?
      merge_association hash, association.root, association.serialize_many, unique_values
    end
  elsif association.embed_objects?
    node[association.key] = association.serialize
  end
end