diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-05-16 21:04:46 -0300 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2012-05-16 21:04:46 -0300 |
commit | 1f0e2de8670587a75453f064cf384c2382c88526 (patch) | |
tree | ffff0a98bf05dd49e29db46c68f0e3df5ecc99e0 | |
parent | 982ed06b3ab963bd3bd0beb50f948bba803fdc4c (diff) | |
download | rails-1f0e2de8670587a75453f064cf384c2382c88526.tar.gz rails-1f0e2de8670587a75453f064cf384c2382c88526.tar.bz2 rails-1f0e2de8670587a75453f064cf384c2382c88526.zip |
Document the usage of grouped_options_for_select with divider option
-rw-r--r-- | actionpack/lib/action_view/helpers/form_options_helper.rb | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index 35015ba4d2..52eb1aa447 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -464,7 +464,7 @@ module ActionView # Options: # * <tt>:prompt</tt> - set to true or a prompt string. When the select element doesn't have a value yet, this # prepends an option with a generic prompt - "Please select" - or the given prompt string. - # * <tt>:delimiter</tt> - the delimiter for the options groups. + # * <tt>:divider</tt> - the divider for the options groups. # # Sample usage (Array): # grouped_options = [ @@ -493,6 +493,24 @@ module ActionView # <option value="Canada">Canada</option> # </optgroup> # + # Sample usage (divider): + # grouped_options = [ + # [['United States','US'], 'Canada'], + # ['Denmark','Germany','France'] + # ] + # grouped_options_for_select(grouped_options, divider: '---------') + # + # Possible output: + # <optgroup label="---------"> + # <option value="Denmark">Denmark</option> + # <option value="Germany">Germany</option> + # <option value="France">France</option> + # </optgroup> + # <optgroup label="---------"> + # <option value="US">United States</option> + # <option value="Canada">Canada</option> + # </optgroup> + # # <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(*args) |