From 04f52219f11944e50555dc59917c73c99581dac0 Mon Sep 17 00:00:00 2001 From: Andrew Vit Date: Mon, 5 May 2008 12:45:09 -0700 Subject: Fixed form helper's name attribute for question methods --- actionpack/lib/action_view/helpers/form_helper.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'actionpack/lib/action_view') diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 63c5fd57aa..b8600fe445 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -614,23 +614,27 @@ module ActionView end def tag_name - "#{@object_name}[#{@method_name}]" + "#{@object_name}[#{sanitized_method_name}]" end def tag_name_with_index(index) - "#{@object_name}[#{index}][#{@method_name}]" + "#{@object_name}[#{index}][#{sanitized_method_name}]" end def tag_id - "#{sanitized_object_name}_#{@method_name}" + "#{sanitized_object_name}_#{sanitized_method_name}" end def tag_id_with_index(index) - "#{sanitized_object_name}_#{index}_#{@method_name}" + "#{sanitized_object_name}_#{index}_#{sanitized_method_name}" end def sanitized_object_name - @object_name.gsub(/[^-a-zA-Z0-9:.]/, "_").sub(/_$/, "") + @sanitized_object_name ||= @object_name.gsub(/[^-a-zA-Z0-9:.]/, "_").sub(/_$/, "") + end + + def sanitized_method_name + @sanitized_method_name ||= @method_name.sub(/\?$/,"") end end -- cgit v1.2.3