{"record":{"id":"1acb655fe7af05c9","repo":"heartcombo/simple_form","slug":"name-method-now-accepts-a-wrapper-options-arg","errorCode":null,"errorMessage":"%{name} method now accepts a `wrapper_options` argument. The method definition without the argument is deprecated and will be removed in the next Simple Form version. Change your code from:\n\n    def %{name}\n\nto\n\n    def %{name}(wrapper_options)\n\nSee https://github.com/heartcombo/simple_form/pull/997 for more information.","messagePattern":"%(.+?) method now accepts a `wrapper_options` argument\\. The method definition without the argument is deprecated and will be removed in the next Simple Form version\\. Change your code from:\n\n    def %(.+?)\n\nto\n\n    def %(.+?)\\(wrapper_options\\)\n\nSee https://github\\.com/heartcombo/simple_form/pull/997 for more information\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"lib/simple_form/components/label_input.rb","lineNumber":25,"sourceCode":"      included do\n        include SimpleForm::Components::Labels\n      end\n\n      def label_input(wrapper_options = nil)\n        if options[:label] == false\n          deprecated_component(:input, wrapper_options)\n        else\n          deprecated_component(:label, wrapper_options) + deprecated_component(:input, wrapper_options)\n        end\n      end\n\n      private\n\n      def deprecated_component(namespace, wrapper_options)\n        method = method(namespace)\n\n        if method.arity.zero?\n          SimpleForm.deprecator.warn(SimpleForm::CUSTOM_INPUT_DEPRECATION_WARN % { name: namespace })\n\n          method.call\n        else\n          method.call(wrapper_options)\n        end\n      end\n    end\n  end\nend\n","sourceCodeStart":7,"sourceCodeEnd":35,"githubUrl":"https://github.com/heartcombo/simple_form/blob/18f38aad0bdeca2ba1815043b94d96fdbbe6a325/lib/simple_form/components/label_input.rb#L7-L35","documentation":"The wrapper's :label_input component calls the input's #label and #input methods; since PR #997 these receive wrapper_options (the wrapper's per-component options, e.g. wrap_with classes). LabelInput#deprecated_component checks method arity: a zero-parameter definition is called without the argument and warned via SimpleForm.deprecator with CUSTOM_INPUT_DEPRECATION_WARN (lib/simple_form/components/label_input.rb:25). It fires when a custom input overrides label or input without the wrapper_options parameter.","triggerScenarios":"A custom input class defining def input or def label with no parameters, rendered through a wrapper that uses :label_input; custom inputs written for simple_form versions before PR #997 (pre-3.1) running on a newer gem.","commonSituations":"Upgrading simple_form with legacy custom inputs in app code or vendored gems; overriding def input for styling and forgetting the parameter; old fork/plugin inputs that never adopted the new signature.","solutions":["Add the parameter to overridden methods: def input(wrapper_options) — or def input(wrapper_options = nil), since an optional parameter makes arity non-zero and also silences the warning","Apply the same change to any overridden label, hint, error or other component method used in wrappers","In the test environment, set SimpleForm.deprecator behavior to raise so all zero-arity overrides fail in one test run instead of trickling into production logs"],"exampleFix":"# before\nclass UpperCaseInput < SimpleForm::Inputs::StringInput\n  def input   # deprecation: missing wrapper_options\n    super.upcase\n  end\nend\n\n# after\nclass UpperCaseInput < SimpleForm::Inputs::StringInput\n  def input(wrapper_options = nil)\n    super(wrapper_options).upcase\n  end\nend","handlingStrategy":"validation","validationCode":"# boot-time arity audit for overridden input methods\n[UpperCaseInput, FancyLabelInput].each do |klass|\n  %i[label input label_input].each do |name|\n    next unless klass.method_defined?(name)\n    Rails.logger.warn(\"#{klass}##{name} should accept wrapper_options\") if klass.instance_method(name).arity.zero?\n  end\nend","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always define overridden component methods as def input(wrapper_options) or with an optional default","Set SimpleForm.deprecator behavior to raise in the test environment so signature drift fails CI","Re-audit custom inputs against the generated initializer after each simple_form upgrade"],"tags":["simple-form","deprecation","wrapper-options","custom-input","label-input"],"backgroundTag":"deprecated-method-signature","analyzedSha":"18f38aad0bdeca2ba1815043b94d96fdbbe6a325","analyzedAt":"2026-08-21T18:23:08.988Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}