Module: WatermelonDbSync::ModelSyncCallback

Extended by:
ActiveSupport::Concern
Defined in:
lib/watermelon_db_sync/model_sync_callback.rb

Instance Method Summary collapse

Instance Method Details

#update_versionObject

handle updating version when record is deleted



22
23
24
25
# File 'lib/watermelon_db_sync/model_sync_callback.rb', line 22

def update_version
  return unless WatermelonDbSync.configuration.sync_models.include? self.class.name
  update_column(:version, Sync.next_global_seqs) #skip callback
end

#update_version_and_updated_at_serverObject

handle updating version when record is updated



15
16
17
18
19
# File 'lib/watermelon_db_sync/model_sync_callback.rb', line 15

def update_version_and_updated_at_server
  return unless WatermelonDbSync.configuration.sync_models.include? self.class.name
  self.version = Sync.next_global_seqs
  self.updated_at_server = Time.zone.now
end