Skip to content

Commit

Permalink
Tighten the rescue clause when dealing with invalid instance variable…
Browse files Browse the repository at this point in the history
… names in form_helper.
  • Loading branch information
NZKoz committed Jul 3, 2008
1 parent d79cde3 commit 75e04b5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion actionpack/lib/action_view/helpers/form_helper.rb
Expand Up @@ -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)
Expand Down

0 comments on commit 75e04b5

Please sign in to comment.