aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/form_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/form_helper.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb
index fa5a9bfac6..bafc635ad2 100644
--- a/actionpack/lib/action_view/helpers/form_helper.rb
+++ b/actionpack/lib/action_view/helpers/form_helper.rb
@@ -601,7 +601,11 @@ module ActionView
end
def object
- @object || (@template_object.instance_variable_get("@#{@object_name}") rescue nil)
+ @object || @template_object.instance_variable_get("@#{@object_name}")
+ rescue NameError
+ # As @object_name may contain the nested syntax (item[subobject]) we
+ # need to fallback to nil.
+ nil
end
def value(object)