diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-01 11:15:56 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2014-05-01 11:15:56 -0300 |
commit | 71669b9d3e53a387079dad8108893ae876ac6c7a (patch) | |
tree | c55ebdedf5675cd5e21ef2c489f6ab338666b2cf /actionview/lib | |
parent | bf44fcc6c4af0807cdcb7d3e5567b0ec1f40cad5 (diff) | |
parent | 55880b342180011cf4c95154aba8fdfcc71b9418 (diff) | |
download | rails-71669b9d3e53a387079dad8108893ae876ac6c7a.tar.gz rails-71669b9d3e53a387079dad8108893ae876ac6c7a.tar.bz2 rails-71669b9d3e53a387079dad8108893ae876ac6c7a.zip |
Merge pull request #14922 from rizwanreza/add-selected-documentation-to-select-tag
Add documentation to select_tag for :selected option
Diffstat (limited to 'actionview/lib')
-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> # |