Class: Restforce::DB::Initializer
- Defined in:
- lib/restforce/db/initializer.rb
Overview
Restforce::DB::Initializer is responsible for ensuring that both systems are populated with the same records at the root level. It iterates through recently added or updated records in each system for a mapping, and creates a matching record in the other system, when necessary.
Instance Method Summary collapse
-
#run(*_) ⇒ Object
Public: Run the initialization loop for this mapping.
Methods inherited from Task
Constructor Details
This class inherits a constructor from Restforce::DB::Task
Instance Method Details
#run(*_) ⇒ Object
Public: Run the initialization loop for this mapping.
Returns nothing.
14 15 16 17 18 19 20 21 |
# File 'lib/restforce/db/initializer.rb', line 14 def run(*_) return if @mapping.strategy.passive? @runner.run(@mapping) do |run| run.salesforce_instances.each { |instance| create_in_database(instance) } run.database_instances.each { |instance| create_in_salesforce(instance) } end end |