internetee-registry/app/jobs/domain_delete_job.rb
2016-03-02 17:44:25 +02:00

16 lines
401 B
Ruby

class DomainDeleteJob < Que::Job
def run(domain_id)
domain = Domain.find(domain_id)
WhoisRecord.where(domain_id: domain.id).destroy_all
domain.destroy
bye_bye = domain.versions.last
domain.registrar.messages.create!(
body: "#{I18n.t(:domain_deleted)}: #{domain.name}",
attached_obj_id: bye_bye.id,
attached_obj_type: bye_bye.class.to_s
)
end
end