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.
This commit is contained in:
parent
aeb00f73cf
commit
b6e6f27fdf
1 changed files with 3 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue