diff --git a/app/components/DS/menu_item.rb b/app/components/DS/menu_item.rb index 5b099e7af..5aa3959b3 100644 --- a/app/components/DS/menu_item.rb +++ b/app/components/DS/menu_item.rb @@ -50,7 +50,8 @@ class DS::MenuItem < DesignSystemComponent data = 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) end if frame.present? diff --git a/app/views/rules/index.html.erb b/app/views/rules/index.html.erb index 0acacb0fc..0b10c4557 100644 --- a/app/views/rules/index.html.erb +++ b/app/views/rules/index.html.erb @@ -3,6 +3,17 @@
<% 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",