@@ -100,25 +100,22 @@ module FormOptionsHelper
100
100
#
101
101
# There are two possible formats for the +choices+ parameter, corresponding to other helpers' output:
102
102
#
103
- # * A flat collection (see +options_for_select+).
103
+ # * A flat collection (see <tt>options_for_select</tt>).
104
+ # * A nested collection (see <tt>grouped_options_for_select</tt>).
104
105
#
105
- # * A nested collection (see +grouped_options_for_select+).
106
+ # Example with <tt>@post.person_id => 2</tt>:
106
107
#
107
- # For example:
108
- #
109
- # select("post", "person_id", Person.all.collect { |p| [ p.name, p.id ] }, { include_blank: true })
108
+ # select :post, :person_id, Person.all.collect { |p| [ p.name, p.id ] }, { include_blank: true })
110
109
#
111
110
# would become:
112
111
#
113
112
# <select name="post[person_id]" id="post_person_id">
114
113
# <option value="" label=" "></option>
115
- # <option value="1" selected="selected" >David</option>
116
- # <option value="2">Eileen</option>
114
+ # <option value="1">David</option>
115
+ # <option value="2" selected="selected" >Eileen</option>
117
116
# <option value="3">Rafael</option>
118
117
# </select>
119
118
#
120
- # assuming the associated person has ID 1.
121
- #
122
119
# This can be used to provide a default set of options in the standard way: before rendering the create form, a
123
120
# new model instance is assigned the default options and bound to @model_name. Usually this model is not saved
124
121
# to the database. Instead, a second model object is created when the create request is received.
0 commit comments