app/models/mission.rb
# DEPRECATED: This should go away and be replaced with use of destroy and a background job.
# No need to maintain all this extra logic. Mission delete happens rarely and can be slow.
This should go away and be replaced with use of destroy and a background job.
No need to maintain all this extra logic. Mission delete happens rarely and can be slow.
This should go away and be replaced with use of destroy and a background job . No need to maintain all this extra logic . Mission delete happens rarely and can be slow .
def destroy
    transaction do
      [Setting, Report::Report].each { |r| r.mission_pre_delete(self) }
      ResponseDestroyer.new(scope: Response.where(mission: self)).destroy!
      relationships_to_delete = [Condition, FormItem, Question, OptionSet, Option,
                                 Form, Broadcast, Assignment, Sms::Message, UserGroup, Operation]
      relationships_to_delete.each { |r| r.mission_pre_delete(self) }
      reload
      check_associations
      delete
    end
  end
def destroy transaction do [ Setting , Report :: Report ] . each { | r | r . mission_pre_delete ( self ) } ResponseDestroyer . new ( scope : Response . where ( mission : self ) ) . destroy! relationships_to_delete = [ Condition , FormItem , Question , OptionSet , Option , Form , Broadcast , Assignment , Sms :: Message , UserGroup , Operation ] relationships_to_delete . each { | r | r . mission_pre_delete ( self ) } reload check_associations delete end end
DEPRECATED: This should go away and be replaced with use of destroy and a background job.
DEPRECATED : This should go away and be replaced with use of destroy and a background job .
# The order of deletion is also important to avoid foreign key constraints