From 5d61d2336cceebf388369f22fa4cfbc07983bde5 Mon Sep 17 00:00:00 2001 From: Marcel Molina Date: Tue, 25 Apr 2006 19:38:52 +0000 Subject: Refactor various InstanceTag instance method to class methods. Closes #4800. [skaes@web.de] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4272 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/form_options_helper.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'actionpack/lib/action_view/helpers/form_options_helper.rb') diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index 53b39305fa..4c830afb02 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -299,6 +299,7 @@ module ActionView def to_select_tag(choices, options, html_options) html_options = html_options.stringify_keys add_default_name_and_id(html_options) + value = value(object) selected_value = options.has_key?(:selected) ? options[:selected] : value content_tag("select", add_options(options_for_select(choices, selected_value), options, value), html_options) end @@ -306,6 +307,7 @@ module ActionView def to_collection_select_tag(collection, value_method, text_method, options, html_options) html_options = html_options.stringify_keys add_default_name_and_id(html_options) + value = value(object) content_tag( "select", add_options(options_from_collection_for_select(collection, value_method, text_method, value), options, value), html_options ) @@ -314,12 +316,14 @@ module ActionView def to_country_select_tag(priority_countries, options, html_options) html_options = html_options.stringify_keys add_default_name_and_id(html_options) + value = value(object) content_tag("select", add_options(country_options_for_select(value, priority_countries), options, value), html_options) end def to_time_zone_select_tag(priority_zones, options, html_options) html_options = html_options.stringify_keys add_default_name_and_id(html_options) + value = value(object) content_tag("select", add_options( time_zone_options_for_select(value, priority_zones, options[:model] || TimeZone), -- cgit v1.2.3