aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2008-07-01 20:43:57 +0300
committerMichael Koziarski <michael@koziarski.com>2008-07-03 19:43:20 +0300
commit75e04b52956512d554c83e0134a81c980c15b4fa (patch)
treee4c1cf49cc7bd6b90aa6634b8cfdab20b5a8366d
parentd79cde37ea9a14fc6625297f40050296af7f7630 (diff)
downloadrails-75e04b52956512d554c83e0134a81c980c15b4fa.tar.gz
rails-75e04b52956512d554c83e0134a81c980c15b4fa.tar.bz2
rails-75e04b52956512d554c83e0134a81c980c15b4fa.zip
Tighten the rescue clause when dealing with invalid instance variable names in form_helper.
-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)