diff --git a/CHANGELOG.md b/CHANGELOG.md index eb32b4ca..64ec3c81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## Unreleased +* Revert "Speed up input mapping lookup by avoiding rescuing exceptions" from v5.3.0, it caused a regression on dev/test environments with custom inputs. * Add support to Ruby 3.3. (no changes required.) ## 5.3.0 diff --git a/lib/simple_form/form_builder.rb b/lib/simple_form/form_builder.rb index a5cb4c14..da723cb7 100644 --- a/lib/simple_form/form_builder.rb +++ b/lib/simple_form/form_builder.rb @@ -673,7 +673,11 @@ def mapping_override(klass) def attempt_mapping(mapping, at) return if SimpleForm.inputs_discovery == false && at == Object - at.const_get(mapping) if at.const_defined?(mapping) + begin + at.const_get(mapping) + rescue NameError => e + raise if e.message !~ /#{mapping}$/ + end end def attempt_mapping_with_custom_namespace(input_name)