Class: Restforce::DB::Associator

Inherits:
Task
  • Object
show all
Defined in:
lib/restforce/db/associator.rb

Overview

Restforce::DB::Associator is responsible for determining when one or more associations have been updated to point to a new Salesforce/database record, and propagate the modification to the opposite system when this occurs.

Instance Method Summary collapse

Methods inherited from Task

#initialize

Constructor Details

This class inherits a constructor from Restforce::DB::Task

Instance Method Details

#run(*_) ⇒ Object

Public: Run the re-association process, pulling in records from Salesforce and the database to determine the most recently attached association, then propagating the change between systems.

Returns nothing.



16
17
18
19
20
21
22
23
# File 'lib/restforce/db/associator.rb', line 16

def run(*_)
  return if belongs_to_associations.empty?

  @runner.run(@mapping) do |run|
    run.salesforce_instances.each { |instance| verify_associations(instance) }
    run.database_instances.each { |instance| verify_associations(instance) }
  end
end