Tighten the rescue clause when dealing with invalid instance variable names in form_helper.

This commit is contained in:
Michael Koziarski 2008-07-01 20:43:57 +03:00
parent d79cde37ea
commit 75e04b5295
1 changed files with 5 additions and 1 deletions

View File

@ -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)