From 26d84d41c3a4f2c8497c3ff89b1a4761d4d8bb17 Mon Sep 17 00:00:00 2001 From: bartimez Date: Wed, 21 Jun 2023 16:16:04 -0400 Subject: [PATCH] Do not append contents unless it exists. A bit of cleanup. --- lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb b/lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb index 663b4016..c8ff0e28 100644 --- a/lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb +++ b/lib/formtastic-bootstrap/helpers/fieldset_wrapper.rb @@ -21,15 +21,15 @@ def field_set_and_list_wrapping(*args, &block) #:nodoc: # Ruby 1.9: String#to_s behavior changed, need to make an explicit join. contents = contents.join if contents.respond_to?(:join) - legend = field_set_legend(html_options) - fieldset = template.content_tag(:fieldset, - legend.html_safe << contents.html_safe, + legend = field_set_legend(html_options).html_safe + legend << contents.html_safe if contents.present? + + template.content_tag( + :fieldset, + legend, html_options.except(:builder, :parent, :name) ) - - fieldset end - end end end