diff options
author | Andrew Vit <andrew@avit.ca> | 2008-05-05 12:45:09 -0700 |
---|---|---|
committer | rick <rick@spacemonkey.local> | 2008-05-06 00:03:32 -0700 |
commit | 04f52219f11944e50555dc59917c73c99581dac0 (patch) | |
tree | 4f6ebcdc370ac5de6aba10c376630d2237af0c72 /actionpack/lib/action_view | |
parent | 123e55686de920499cc8572f3a8b4d585d20ab02 (diff) | |
download | rails-04f52219f11944e50555dc59917c73c99581dac0.tar.gz rails-04f52219f11944e50555dc59917c73c99581dac0.tar.bz2 rails-04f52219f11944e50555dc59917c73c99581dac0.zip |
Fixed form helper's name attribute for question methods
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 14 |
1 files changed, 9 insertions, 5 deletions
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 |