Class: Kidspire::SyncSetting

Inherits:
ApplicationRecord show all
Defined in:
app/models/kidspire/sync_setting.rb

Constant Summary collapse

CONFLICT_STRATEGIES =
%w[pco_wins kidspire_wins newest_wins].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.currentObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/models/kidspire/sync_setting.rb', line 8

def self.current
  first_or_create!(
    inbound_people_sync:         true,
    outbound_people_sync:        false,
    inbound_events_sync:         true,
    outbound_registrations_sync: false,
    sync_frequency_hours:        6,
    conflict_resolution:         "pco_wins",
    auto_sync_enabled:           false,
    pco_kids_ministry_tag:       nil
  )
end

Instance Method Details

#effective_ministry_tagObject

Reads tag from DB; falls back to the env var so existing deployments continue working before the settings page is used for the first time.



23
24
25
26
# File 'app/models/kidspire/sync_setting.rb', line 23

def effective_ministry_tag
  pco_kids_ministry_tag.presence ||
    Kidspire.configuration.pco_kids_ministry_tag.presence
end