From 1830cc87baf0e85872571d4edfdd64fcd89cec0a Mon Sep 17 00:00:00 2001 From: Alex Date: Tue, 5 Sep 2023 11:47:25 +1000 Subject: [PATCH] Allow overriding `button_to_generates_button_tag` per-invocation ref: https://github.com/rails/rails/pull/40747 The global config is great for new projects, but for large existing projects, auditing every `button_to` call could be overwhelming enough to not bother. This PR allows you to set if a button should always be returned per-invocation. This way you can gradually opt in to the config, or you can use it only in parts of your codebase. ```ruby button_to("Save", "http://www.example.com") # renders button_to("Save", "http://www.example.com", button_tag: true) # renders }, + button_to("Save", "http://www.example.com", button_tag: true) + ) + ensure + ActionView::Helpers::UrlHelper.button_to_generates_button_tag = old_value + end + def test_button_to_with_content_exfiltration_prevention with_prepend_content_exfiltration_prevention(true) do assert_dom_equal(