def become_sibling_of(other, options = {})
      return true if self.sibling_of?(other, options)

      scopes              = options[:scope]               || self.default_sibling_scope
      other_scope_values  = options[:other_scope_values]  || {}

      scopes = Array.wrap(scopes).compact


      return false if base_document_class != base_document_class(other)

      scopes.each do |scope|
        other_scope_value = other_scope_values.fetch(scope) { other.send(scope) }

        relation_metadata = self.reflect_on_association(scope)
        if relation_metadata && other_scope_value
          inverse_metadata = other.intelligent_inverse_metadata(scope, other_scope_value)
          if inverse_metadata
            inverse = inverse_metadata.name
            if inverse_metadata.many?
              other_scope_value.send(inverse) << self
            else
              other_scope_value.send("#{inverse}=", self)
            end

            next
          end
        end
        self.send("#{scope}=", other_scope_value)
      end
    end
def become_sibling_of(other, options = {})
      return true if self.sibling_of?(other, options)

      scopes              = options[:scope]               || self.default_sibling_scope
      other_scope_values  = options[:other_scope_values]  || {}

      scopes = Array.wrap(scopes).compact


      return false if base_document_class != base_document_class(other)

      scopes.each do |scope|
        other_scope_value = other_scope_values.fetch(scope) { other.send(scope) }

        relation_metadata = self.reflect_on_association(scope)
        if relation_metadata && other_scope_value
          inverse_metadata = other.intelligent_inverse_metadata(scope, other_scope_value)
          if inverse_metadata
            inverse = inverse_metadata.name
            if inverse_metadata.many?
              other_scope_value.send(inverse) << self
            else
              other_scope_value.send("#{inverse}=", self)
            end

            next
          end
        end
        self.send("#{scope}=", other_scope_value)
      end
    end
Makes this document a sibling of the other document.

 This is done by copying over the values used to determine siblingship
 from the other document.

 @example Make document a sibling of the other document.
   book.become_sibling_of(book_of_other_author, scope: :author)

 @param [ Document ] other The document to become a sibling of.
 @param [ Hash ] options The options.

 @option options [ Array<Symbol>, Symbol ] scope One or more relations and
   attributes that siblings of this object need to have in common.
 @option options [ Hash<Symbol, Object> ] other_scope_values Optional
   alternative values to use to determine siblingship.

 @return [ Boolean ] True if the document was made a sibling of the other
   document.