diff options
author | kennyj <kennyj@gmail.com> | 2013-06-28 02:50:58 +0900 |
---|---|---|
committer | kennyj <kennyj@gmail.com> | 2013-06-28 03:11:00 +0900 |
commit | 94c72c45bb1106a67e2dcf504419c5b141c1fc66 (patch) | |
tree | 4676666372c0a3c9d19edf42b0f144efad1ff8c2 /actionview | |
parent | 4f1a7dc9567af6aea6f6f53177d4a9e61b6dd3c5 (diff) | |
download | rails-94c72c45bb1106a67e2dcf504419c5b141c1fc66.tar.gz rails-94c72c45bb1106a67e2dcf504419c5b141c1fc66.tar.bz2 rails-94c72c45bb1106a67e2dcf504419c5b141c1fc66.zip |
Remove passing the prompt to grouped_options_for_select as an argument, because it was deprecated.
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/CHANGELOG.md | 5 | ||||
-rw-r--r-- | actionview/lib/action_view/helpers/form_options_helper.rb | 11 | ||||
-rw-r--r-- | actionview/test/template/form_options_helper_test.rb | 17 |
3 files changed, 7 insertions, 26 deletions
diff --git a/actionview/CHANGELOG.md b/actionview/CHANGELOG.md index 31e123d916..cda3ec5109 100644 --- a/actionview/CHANGELOG.md +++ b/actionview/CHANGELOG.md @@ -1,3 +1,8 @@ +* Remove passing the prompt to `grouped_options_for_select` as an argument, because + it was deprecated. + + *kennyj* + * Always escape the result of `link_to_unless` method. Before: diff --git a/actionview/lib/action_view/helpers/form_options_helper.rb b/actionview/lib/action_view/helpers/form_options_helper.rb index ab5aae9b13..4e9ef94ff3 100644 --- a/actionview/lib/action_view/helpers/form_options_helper.rb +++ b/actionview/lib/action_view/helpers/form_options_helper.rb @@ -510,15 +510,8 @@ module ActionView # <b>Note:</b> Only the <tt><optgroup></tt> and <tt><option></tt> tags are returned, so you still have to # wrap the output in an appropriate <tt><select></tt> tag. def grouped_options_for_select(grouped_options, selected_key = nil, options = {}) - if options.is_a?(Hash) - prompt = options[:prompt] - divider = options[:divider] - else - prompt = options - message = "Passing the prompt to grouped_options_for_select as an argument is deprecated. " \ - "Please use an options hash like `{ prompt: #{prompt.inspect} }`." - ActiveSupport::Deprecation.warn message - end + prompt = options[:prompt] + divider = options[:divider] body = "".html_safe diff --git a/actionview/test/template/form_options_helper_test.rb b/actionview/test/template/form_options_helper_test.rb index 1715902927..8c90a58a84 100644 --- a/actionview/test/template/form_options_helper_test.rb +++ b/actionview/test/template/form_options_helper_test.rb @@ -310,15 +310,6 @@ class FormOptionsHelperTest < ActionView::TestCase ) end - def test_grouped_options_for_select_with_selected_and_prompt_deprecated - assert_deprecated 'Passing the prompt to grouped_options_for_select as an argument is deprecated. Please use an options hash like `{ prompt: "Choose a product..." }`.' do - assert_dom_equal( - "<option value=\"\">Choose a product...</option><optgroup label=\"Hats\"><option value=\"Baseball Cap\">Baseball Cap</option>\n<option selected=\"selected\" value=\"Cowboy Hat\">Cowboy Hat</option></optgroup>", - grouped_options_for_select([["Hats", ["Baseball Cap","Cowboy Hat"]]], "Cowboy Hat", "Choose a product...") - ) - end - end - def test_grouped_options_for_select_with_selected_and_prompt assert_dom_equal( "<option value=\"\">Choose a product...</option><optgroup label=\"Hats\"><option value=\"Baseball Cap\">Baseball Cap</option>\n<option selected=\"selected\" value=\"Cowboy Hat\">Cowboy Hat</option></optgroup>", @@ -337,14 +328,6 @@ class FormOptionsHelperTest < ActionView::TestCase assert grouped_options_for_select([["Hats", ["Baseball Cap","Cowboy Hat"]]]).html_safe? end - def test_grouped_options_for_select_with_prompt_returns_html_escaped_string_deprecated - ActiveSupport::Deprecation.silence do - assert_dom_equal( - "<option value=\"\"><Choose One></option><optgroup label=\"Hats\"><option value=\"Baseball Cap\">Baseball Cap</option>\n<option value=\"Cowboy Hat\">Cowboy Hat</option></optgroup>", - grouped_options_for_select([["Hats", ["Baseball Cap","Cowboy Hat"]]], nil, '<Choose One>')) - end - end - def test_grouped_options_for_select_with_prompt_returns_html_escaped_string assert_dom_equal( "<option value=\"\"><Choose One></option><optgroup label=\"Hats\"><option value=\"Baseball Cap\">Baseball Cap</option>\n<option value=\"Cowboy Hat\">Cowboy Hat</option></optgroup>", |