diff options
Diffstat (limited to 'actionpack/lib/action_view/helpers/form_helper.rb')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_helper.rb | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 286defa54e..eef7d1f567 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -267,7 +267,7 @@ module ActionView end options["checked"] = "checked" if checked pretty_tag_value = tag_value.to_s.gsub(/\s/, "_").gsub(/\W/, "").downcase - options["id"] = @auto_index ? + options["id"] = defined?(@auto_index) ? "#{@object_name}_#{@auto_index}_#{@method_name}_#{pretty_tag_value}" : "#{@object_name}_#{@method_name}_#{pretty_tag_value}" add_default_name_and_id(options) @@ -377,7 +377,7 @@ module ActionView options["name"] ||= tag_name_with_index(options["index"]) options["id"] ||= tag_id_with_index(options["index"]) options.delete("index") - elsif @auto_index + elsif defined?(@auto_index) options["name"] ||= tag_name_with_index(@auto_index) options["id"] ||= tag_id_with_index(@auto_index) else |