The personal finance app for everyone (by everyone)
Ruby
Add Reset AI cache button to rules index
eureka928329fe9832a40
diff --git a/app/components/DS/menu_item.rb b/app/components/DS/menu_item.rbindex 5b099e7af2..5aa3959b37 100644--- a/app/components/DS/menu_item.rb+++ b/app/components/DS/menu_item.rb@@ -50,7 +50,8 @@ class DS::MenuItem < DesignSystemComponentdata = merged_opts.delete(:data) || {}if confirm.present?- data = data.merge(turbo_confirm: confirm.to_data_attribute)+ confirm_value = confirm.respond_to?(:to_data_attribute) ? confirm.to_data_attribute : confirm+ data = data.merge(turbo_confirm: confirm_value)endif frame.present?diff --git a/app/views/rules/index.html.erb b/app/views/rules/index.html.erbindex 0acacb0fc7..0b10c4557f 100644--- a/app/views/rules/index.html.erb+++ b/app/views/rules/index.html.erb@@ -3,6 +3,17 @@<div class="flex items-center gap-2"><% if @rules.any? %><%= render DS::Menu.new do |menu| %>+ <% menu.with_item(+ variant: "button",+ text: "Reset AI cache",+ href: clear_ai_cache_rules_path,+ icon: "refresh-cw",+ method: :post,+ confirm: CustomConfirm.new(+ title: "Reset AI cache?",+ body: "Are you sure you want to reset the AI cache? This will allow AI rules to re-process all transactions. This may incur additional API costs.",+ btn_text: "Reset Cache"+ )) %><% menu.with_item(variant: "button",text: "Delete all rules",