From e1724b553e25339cd09df325523cce2f76f464f0 Mon Sep 17 00:00:00 2001 From: Rodrigo Pavano Date: Tue, 1 May 2012 19:18:53 -0300 Subject: [PATCH] Documentation fix in options_for_select helper. Fixed display errors caused by mixing Ruby and HTML code inside the same pre tag [ci skip] --- .../helpers/form_options_helper.rb | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index d61c2bbee2..cafcd93f58 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -288,38 +288,55 @@ def time_zone_select(object, method, priority_zones = nil, options = {}, html_op # # Examples (call, result): # options_for_select([["Dollar", "$"], ["Kroner", "DKK"]]) - # \n + # # + # # # # options_for_select([ "VISA", "MasterCard" ], "MasterCard") - # \n + # # + # # # # options_for_select({ "Basic" => "$20", "Plus" => "$40" }, "$40") - # \n + # # + # # # # options_for_select([ "VISA", "MasterCard", "Discover" ], ["VISA", "Discover"]) - # \n\n + # # + # # + # # # # You can optionally provide html attributes as the last element of the array. # # Examples: # options_for_select([ "Denmark", ["USA", {:class => 'bold'}], "Sweden" ], ["USA", "Sweden"]) - # \n\n + # # + # # + # # # # options_for_select([["Dollar", "$", {:class => "bold"}], ["Kroner", "DKK", {:onclick => "alert('HI');"}]]) - # \n + # # + # # # # If you wish to specify disabled option tags, set +selected+ to be a hash, with :disabled being either a value # or array of values to be disabled. In this case, you can use :selected to specify selected option tags. # # Examples: # options_for_select(["Free", "Basic", "Advanced", "Super Platinum"], :disabled => "Super Platinum") - # \n\n\n + # # + # # + # # + # # # # options_for_select(["Free", "Basic", "Advanced", "Super Platinum"], :disabled => ["Advanced", "Super Platinum"]) - # \n\n\n + # # + # # + # # + # # # # options_for_select(["Free", "Basic", "Advanced", "Super Platinum"], :selected => "Free", :disabled => "Super Platinum") - # \n\n\n + # # + # # + # # + # # # # NOTE: Only the option tags are returned, you have to wrap this call in a regular HTML select tag. def options_for_select(container, selected = nil) -- GitLab