Permalink
Browse files

Tighten the rescue clause when dealing with invalid instance variable…

… names in form_helper.
  • Loading branch information...
NZKoz committed Jul 1, 2008
1 parent d79cde3 commit 75e04b52956512d554c83e0134a81c980c15b4fa
Showing with 5 additions and 1 deletion.
  1. +5 −1 actionpack/lib/action_view/helpers/form_helper.rb
@@ -601,7 +601,11 @@ def to_content_tag(tag_name, options = {})
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)

0 comments on commit 75e04b5

Please sign in to comment.