diff --git a/app/controllers/rules_controller.rb b/app/controllers/rules_controller.rb index 23889dc5a..b516e44f1 100644 --- a/app/controllers/rules_controller.rb +++ b/app/controllers/rules_controller.rb @@ -128,6 +128,11 @@ class RulesController < ApplicationController redirect_back_or_to rules_path, notice: t("rules.apply_all.success") end + def clear_ai_cache + ClearAiCacheJob.perform_later(Current.family) + redirect_to rules_path, notice: "AI cache is being cleared. This may take a few moments." + end + private def set_rule @rule = Current.family.rules.find(params[:id]) diff --git a/config/routes.rb b/config/routes.rb index 96ad6a28d..b718be561 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -292,6 +292,7 @@ Rails.application.routes.draw do delete :destroy_all get :confirm_all post :apply_all + post :clear_ai_cache end end