1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Document the usage of grouped_options_for_select with divider option

This commit is contained in:
Rafael Mendonça França 2012-05-16 21:04:46 -03:00
parent 982ed06b3a
commit 1f0e2de867

View file

@ -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)