lib/packages/core-classes.js
function(foreign_module_id_field, event_args) {

		var referenced_record = event_args.record, // record belongs to foreign module
			new_referenced_id = referenced_record.get('id'),
			collection,
			i = 0,
			count;

		if (referenced_record.guid in this._collections_by_foreign_guid) {

			collection = this._collections_by_foreign_guid[referenced_record.guid];

			// Set the value of foreign ID field in all local records that reference this foreign record.
			// Situation: there is a new record, which was created in the browser, and some records that reference it
			// (either new or loaded from database). It's new, so there are no records on server that reference it.
			if (this._foreign_key_field) {

				Lava.suspendListener(this._foreign_key_changed_listener);

				for (count = collection.length; i < count; i++) {

					collection[i].set(this._foreign_key_field_name, new_referenced_id);

				}

				Lava.resumeListener(this._foreign_key_changed_listener);

			}

		}

	}
function(foreign_module_id_field, event_args) {

		var referenced_record = event_args.record, // record belongs to foreign module
			new_referenced_id = referenced_record.get('id'),
			collection,
			i = 0,
			count;

		if (referenced_record.guid in this._collections_by_foreign_guid) {

			collection = this._collections_by_foreign_guid[referenced_record.guid];

			// Set the value of foreign ID field in all local records that reference this foreign record.
			// Situation: there is a new record, which was created in the browser, and some records that reference it
			// (either new or loaded from database). It's new, so there are no records on server that reference it.
			if (this._foreign_key_field) {

				Lava.suspendListener(this._foreign_key_changed_listener);

				for (count = collection.length; i < count; i++) {

					collection[i].set(this._foreign_key_field_name, new_referenced_id);

				}

				Lava.resumeListener(this._foreign_key_changed_listener);

			}

		}

	}
function ( foreign_module_id_field , event_args ) { var referenced_record = event_args . record , // record belongs to foreign module new_referenced_id = referenced_record . get ( 'id' ) , collection , i = 0 , count ; if ( referenced_record . guid in this . _collections_by_foreign_guid ) { collection = this . _collections_by_foreign_guid [ referenced_record . guid ] ; // Set the value of foreign ID field in all local records that reference this foreign record. // Situation: there is a new record, which was created in the browser, and some records that reference it // (either new or loaded from database). It's new, so there are no records on server that reference it. if ( this . _foreign_key_field ) { Lava . suspendListener ( this . _foreign_key_changed_listener ) ; for ( count = collection . length ; i < count ; i ++ ) { collection [ i ] . set ( this . _foreign_key_field_name , new_referenced_id ) ; } Lava . resumeListener ( this . _foreign_key_changed_listener ) ; } } }
A record was saved to the database and assigned an id. Need to assign foreign keys for local records
@param {Lava.data.field.Id} foreign_module_id_field
@param {Lava.data.field.Abstract#event:changed} event_args
A record was saved to the database and assigned an id . Need to assign foreign keys for local records