diff --git a/app/controllers/custom_wizard/admin/wizard.rb b/app/controllers/custom_wizard/admin/wizard.rb index 6737da6c..08e7b6d0 100644 --- a/app/controllers/custom_wizard/admin/wizard.rb +++ b/app/controllers/custom_wizard/admin/wizard.rb @@ -26,8 +26,6 @@ class CustomWizard::AdminWizardController < CustomWizard::AdminController def remove if CustomWizard::Template.remove(@wizard.id) - related_custom_fields = CategoryCustomField.where(name: 'create_topic_wizard', value: @wizard.name) - related_custom_fields.destroy_all render json: success_json else render json: failed_json diff --git a/lib/custom_wizard/template.rb b/lib/custom_wizard/template.rb index 12a86bf6..59a9998e 100644 --- a/lib/custom_wizard/template.rb +++ b/lib/custom_wizard/template.rb @@ -64,6 +64,8 @@ class CustomWizard::Template ensure_wizard_upload_references!(wizard_id) PluginStore.remove(CustomWizard::PLUGIN_NAME, wizard.id) clear_user_wizard_redirect(wizard_id, after_time: !!wizard.after_time) + related_custom_fields = CategoryCustomField.where(name: 'create_topic_wizard', value: wizard.name) + related_custom_fields.destroy_all end clear_cache_keys