Class: Restforce::DB::Strategies::Associated
- Inherits:
-
Object
- Object
- Restforce::DB::Strategies::Associated
- Defined in:
- lib/restforce/db/strategies/associated.rb
Overview
Restforce::DB::Strategies::Associated defines an initialization strategy for a mapping in which newly-discovered records should only be synchronized into the other system when a specific associated record has already been synchronized.
Instance Method Summary collapse
-
#build?(record) ⇒ Boolean
Public: Should the passed record be constructed in the other system?.
-
#initialize(with:) ⇒ Associated
constructor
Public: Initialize a Restforce::DB::Strategies::Associated for the passed mapping.
-
#passive? ⇒ Boolean
Public: Is this a passive sync strategy?.
Constructor Details
#initialize(with:) ⇒ Associated
Public: Initialize a Restforce::DB::Strategies::Associated for the passed mapping.
with - A Symbol name of the association which should be checked.
17 18 19 |
# File 'lib/restforce/db/strategies/associated.rb', line 17 def initialize(with:) @association = with.to_sym end |
Instance Method Details
#build?(record) ⇒ Boolean
Public: Should the passed record be constructed in the other system?
record - A Restforce::DB::Instances::Base.
Returns a Boolean.
26 27 28 |
# File 'lib/restforce/db/strategies/associated.rb', line 26 def build?(record) !record.synced? && target_association(record.mapping).synced_for?(record) end |
#passive? ⇒ Boolean
Public: Is this a passive sync strategy?
Returns false.
33 34 35 |
# File 'lib/restforce/db/strategies/associated.rb', line 33 def passive? false end |