From b6e6f27fdf4cc75353d93541ff49fe1147792c2f Mon Sep 17 00:00:00 2001 From: Emi Matchu Date: Sun, 1 Dec 2024 09:45:26 -0800 Subject: [PATCH] Minor refactor to `support_form_with` implementation Realizing that, with the keyword argument spread syntax, I don't need to do merging, I can just. spread at the right place! My rationale for the ordering here is: if the caller theoretically tried to override the builder (even though I don't see why), I think we would want to respect that. Whereas the `class` argument should be overridden because we're safely *merging* our `.support-form` class into it. --- app/helpers/support_form_helper.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/helpers/support_form_helper.rb b/app/helpers/support_form_helper.rb index 067f0e4c..7d8d9a0e 100644 --- a/app/helpers/support_form_helper.rb +++ b/app/helpers/support_form_helper.rb @@ -50,10 +50,11 @@ module SupportFormHelper end def support_form_with(**options, &block) - options.merge!( + form_with( builder: SupportFormBuilder, + **options, class: ["support-form", options[:class]], + &block ) - form_with(**options, &block) end end