class ActiveGit::DbDeleteAll

Public Class Methods

new(model) click to toggle source
# File lib/active_git/events/db_delete_all.rb, line 4
def initialize(model)
  @model = model
end

Public Instance Methods

synchronize(synchronizer) click to toggle source
# File lib/active_git/events/db_delete_all.rb, line 8
def synchronize(synchronizer)
  synchronizer.define_job do
    ActiveGit.configuration.logger.debug "[ActiveGit] Deleting all #{@model.model_name} models"
    @model.delete_all

    @model.git_included_models.each do |nested_model|
      ActiveGit.configuration.logger.debug "[ActiveGit] Deleting all #{nested_model.model_name} models (nested of #{@model.model_name})"
      nested_model.delete_all
    end
  end
end