app/models/project.rb
# !! This is not production ready.
# @return [Boolean]
#   based on whether the project has successfully been deleted.  Can also raise on detected problems with configuration.
This is not production ready.
This is not production ready .
def nuke
    known = ApplicationRecord.subclasses.select {|a| a.column_names.include?('project_id')}.map(&:name)
    known.each do |k|
      next if k.constantize.table_name == 'test_classes' 
      if !MANIFEST.include?(k)
        raise "#{k} has not been added to #nuke order."
      end
    end
    begin
      MANIFEST.each do |o|
        klass = o.constantize
        klass.where(project_id: id).delete_all
      end
      self.destroy
      true
    rescue => e
      raise e
    end
  end
def nuke known = ApplicationRecord . subclasses . select { | a | a . column_names . include? ( 'project_id' ) } . map ( & :name ) known . each do | k | next if k . constantize . table_name == 'test_classes' if ! MANIFEST . include? ( k ) raise "#{k} has not been added to #nuke order." end end begin MANIFEST . each do | o | klass = o . constantize klass . where ( project_id : id ) . delete_all end self . destroy true rescue => e raise e end end
This is not production ready.
This is not production ready .
# TODO: a kludge to ignore stubbed classes in testing
based on whether the project has successfully been deleted. Can also raise on detected problems with configuration.
based on whether the project has successfully been deleted . Can also raise on detected problems with configuration .
Boolean