aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorLeandro Nunes <leandronunes.dev@gmail.com>2015-02-20 12:01:46 -0200
committerLeandro Nunes <leandronunes.dev@gmail.com>2015-02-20 12:01:46 -0200
commit8e02dcdf4eb53aa741c73bf9cfa757ba401d2a27 (patch)
tree619810646c6ebd9e9a30d78d28b0f5c3aef8ab27 /actionview
parent9a476b8cd6724699027eb00ec7ffa8b232d1b734 (diff)
downloadrails-8e02dcdf4eb53aa741c73bf9cfa757ba401d2a27.tar.gz
rails-8e02dcdf4eb53aa741c73bf9cfa757ba401d2a27.tar.bz2
rails-8e02dcdf4eb53aa741c73bf9cfa757ba401d2a27.zip
Corrects the API to method select_tag
The 'selected' option is not doing what it should do. The expected behavior is to pass the value selected by default for the options_from_collection_for_select method
Diffstat (limited to 'actionview')
-rw-r--r--actionview/lib/action_view/helpers/form_tag_helper.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb
index 8bb243b8b7..65a0548ffb 100644
--- a/actionview/lib/action_view/helpers/form_tag_helper.rb
+++ b/actionview/lib/action_view/helpers/form_tag_helper.rb
@@ -84,14 +84,13 @@ module ActionView
# * <tt>:disabled</tt> - If set to true, the user will not be able to use this input.
# * <tt>:include_blank</tt> - If set to true, an empty option will be created. If set to a string, the string will be used as the option's content and the value will be empty.
# * <tt>:prompt</tt> - Create a prompt option with blank value and the text asking user to select something.
- # * <tt>:selected</tt> - Provide a default selected value. It should be of the exact type as the provided options.
# * Any other key creates standard HTML attributes for the tag.
#
# ==== Examples
# select_tag "people", options_from_collection_for_select(@people, "id", "name")
# # <select id="people" name="people"><option value="1">David</option></select>
#
- # select_tag "people", options_from_collection_for_select(@people, "id", "name"), selected: ["1", "David"]
+ # select_tag "people", options_from_collection_for_select(@people, "id", "name", "1")
# # <select id="people" name="people"><option value="1" selected="selected">David</option></select>
#
# select_tag "people", "<option>David</option>".html_safe