From 19d30d63397f91fe1632e39e191e41a1991f123c Mon Sep 17 00:00:00 2001 From: Jeff Dean Date: Sat, 15 May 2010 17:10:34 -0400 Subject: [PATCH] Use the block sytax of fetch for better performance in form helpers --- actionpack/lib/action_view/helpers/form_helper.rb | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/actionpack/lib/action_view/helpers/form_helper.rb b/actionpack/lib/action_view/helpers/form_helper.rb index 414a5d4..d555cf5 100644 --- a/actionpack/lib/action_view/helpers/form_helper.rb +++ b/actionpack/lib/action_view/helpers/form_helper.rb @@ -1042,14 +1042,14 @@ module ActionView def add_default_name_and_id(options) if options.has_key?("index") options["name"] ||= tag_name_with_index(options["index"]) - options["id"] = options.fetch("id", tag_id_with_index(options["index"])) + options["id"] = options.fetch("id") { tag_id_with_index(options["index"]) } options.delete("index") elsif defined?(@auto_index) options["name"] ||= tag_name_with_index(@auto_index) - options["id"] = options.fetch("id", tag_id_with_index(@auto_index)) + options["id"] = options.fetch("id") { tag_id_with_index(@auto_index) } else options["name"] ||= tag_name + (options.has_key?('multiple') ? '[]' : '') - options["id"] = options.fetch("id", tag_id) + options["id"] = options.fetch("id") { tag_id } end end -- 1.6.1.2