Permalink
Browse files

Tighten the rescue clause when dealing with invalid instance variable…

… names in form_helper.
  • Loading branch information...
1 parent 0d96fcc commit b32790c558435a3cb454a1221fb520264d3d42c2 @NZKoz NZKoz committed with jeremy Jul 1, 2008
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 b32790c

Please sign in to comment.