diff --git a/lib/simple_form/helpers.rb b/lib/simple_form/helpers.rb index ec31d2e6..effeae5c 100644 --- a/lib/simple_form/helpers.rb +++ b/lib/simple_form/helpers.rb @@ -3,11 +3,10 @@ module SimpleForm # For instance, disabled cannot be turned on automatically, it requires the # user to explicitly pass the option disabled: true so it may work. module Helpers - autoload :Autofocus, 'simple_form/helpers/autofocus' - autoload :Disabled, 'simple_form/helpers/disabled' - autoload :Readonly, 'simple_form/helpers/readonly' - autoload :Required, 'simple_form/helpers/required' - autoload :Validators, 'simple_form/helpers/validators' - autoload :WrapperOptions, 'simple_form/helpers/wrapper_options' + autoload :Autofocus, 'simple_form/helpers/autofocus' + autoload :Disabled, 'simple_form/helpers/disabled' + autoload :Readonly, 'simple_form/helpers/readonly' + autoload :Required, 'simple_form/helpers/required' + autoload :Validators, 'simple_form/helpers/validators' end end diff --git a/lib/simple_form/helpers/wrapper_options.rb b/lib/simple_form/helpers/wrapper_options.rb deleted file mode 100644 index 893d45d0..00000000 --- a/lib/simple_form/helpers/wrapper_options.rb +++ /dev/null @@ -1,19 +0,0 @@ -module SimpleForm - module Helpers - module WrapperOptions - private - - def merge_wrapper_options(options, context) - if context - options.merge(context.options) do |_, oldval, newval| - if Array === oldval - oldval + Array(newval) - end - end - else - options - end - end - end - end -end diff --git a/lib/simple_form/inputs/base.rb b/lib/simple_form/inputs/base.rb index 39e3abf8..1f22868b 100644 --- a/lib/simple_form/inputs/base.rb +++ b/lib/simple_form/inputs/base.rb @@ -13,7 +13,6 @@ module SimpleForm include SimpleForm::Helpers::Readonly include SimpleForm::Helpers::Required include SimpleForm::Helpers::Validators - include SimpleForm::Helpers::WrapperOptions include SimpleForm::Components::Errors include SimpleForm::Components::Hints @@ -185,6 +184,18 @@ module SimpleForm I18n.t(lookups.shift, scope: :"simple_form.#{namespace}", default: lookups).presence end + + def merge_wrapper_options(options, context) + if context + options.merge(context.options) do |_, oldval, newval| + if Array === oldval + oldval + Array(newval) + end + end + else + options + end + end end end end