Module Mongoid::Relations::Synchronization
In: lib/mongoid/relations/synchronization.rb

This module handles the behaviour for synchronizing foreign keys between both sides of a many to many relations.

Methods

Public Instance methods

Update the inverse keys on destroy.

@example Update the inverse keys.

  document.remove_inverse_keys(metadata)

@param [ Metadata ] meta The document metadata.

@return [ Object ] The updated values.

@since 2.2.1

Is the document able to be synced on the inverse side? This is only if the key has changed and the relation bindings have not been run.

@example Are the foreign keys syncable?

  document.syncable?(metadata)

@param [ Metadata ] metadata The relation metadata.

@return [ true, false ] If we can sync.

@since 2.1.0

Get the synced foreign keys.

@example Get the synced foreign keys.

  document.synced

@return [ Hash ] The synced foreign keys.

@since 2.1.0

Has the document been synced for the foreign key?

@todo Change the sync to be key based.

@example Has the document been synced?

  document.synced?

@param [ String ] foreign_key The foreign key.

@return [ true, false ] If we can sync.

@since 2.1.0

Update the inverse keys for the relation.

@example Update the inverse keys

  document.update_inverse_keys(metadata)

@param [ Metadata ] meta The document metadata.

@return [ Object ] The updated values.

@since 2.1.0

[Validate]