Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

Add clear_ai_cache endpoint to rules controller

eureka928b511b3add970
diff --git a/app/controllers/rules_controller.rb b/app/controllers/rules_controller.rb
index 23889dc5af..b516e44f18 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 96ad6a28d3..b718be5618 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