diff options
author | Rizwan Reza <rizwanreza@gmail.com> | 2014-04-30 21:59:32 -0700 |
---|---|---|
committer | Rizwan Reza <rizwanreza@gmail.com> | 2014-04-30 21:59:32 -0700 |
commit | 55880b342180011cf4c95154aba8fdfcc71b9418 (patch) | |
tree | a6186e5a67d5c26a033cd817232a3dba8cb8bb83 /actionview/lib/action_view | |
parent | 876155705b56e66a8b9ed96f7b79d1c8d1763200 (diff) | |
download | rails-55880b342180011cf4c95154aba8fdfcc71b9418.tar.gz rails-55880b342180011cf4c95154aba8fdfcc71b9418.tar.bz2 rails-55880b342180011cf4c95154aba8fdfcc71b9418.zip |
Add documentation to select_tag for :selected option
Diffstat (limited to 'actionview/lib/action_view')
-rw-r--r-- | actionview/lib/action_view/helpers/form_tag_helper.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/actionview/lib/action_view/helpers/form_tag_helper.rb b/actionview/lib/action_view/helpers/form_tag_helper.rb index 8f10eb46ad..1f931a300d 100644 --- a/actionview/lib/action_view/helpers/form_tag_helper.rb +++ b/actionview/lib/action_view/helpers/form_tag_helper.rb @@ -83,13 +83,17 @@ module ActionView # * <tt>:multiple</tt> - If set to true the selection will allow multiple choices. # * <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. - # * <tt>:prompt</tt> - Create a prompt option with blank value and the text asking user to select something + # * <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. The value provided should be the exact type the options are provided. # * 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 id="people" name="people"><option value="1" selected="selected">David</option></select> + # # select_tag "people", "<option>David</option>".html_safe # # => <select id="people" name="people"><option>David</option></select> # |