|
45 | 45 | { attribute: :title, as: :string, required: true, placeholder: "Enter a title" }, |
46 | 46 | { attribute: :body, as: :text, hint: "A longer description" }, |
47 | 47 | { attribute: :user_id, as: :select, label: "Author", |
| 48 | + prompt: "Choose an author", |
48 | 49 | collection: @users.map { |u| [u.name, u.id] } }, |
49 | 50 | ], |
50 | 51 | url: "#") %> |
|
65 | 66 | { attribute: :body, as: :text, |
66 | 67 | hint: "A longer description" }, |
67 | 68 | { attribute: :user_id, as: :select, label: "Author", |
| 69 | + prompt: "Choose an author", |
68 | 70 | collection: User.pluck(:name, :id) }, |
69 | 71 | ], |
70 | 72 | url: posts_path) %></code></pre> |
|
162 | 164 | <td class="l-ui-table__cell">Array / Proc</td> |
163 | 165 | <td class="l-ui-table__cell">Options for <code>:select</code> fields. Array of <code>[label, value]</code> pairs or a callable.</td> |
164 | 166 | </tr> |
| 167 | + <tr> |
| 168 | + <th class="l-ui-table__cell l-ui-table__cell--primary" scope="row"><code>prompt:</code></th> |
| 169 | + <td class="l-ui-table__cell">String</td> |
| 170 | + <td class="l-ui-table__cell">Prompt text for <code>:select</code> fields (e.g. "Choose an author"). Shown as the first option; only selectable when no value is set. Setting <code>prompt:</code> suppresses the default blank option.</td> |
| 171 | + </tr> |
| 172 | + <tr> |
| 173 | + <th class="l-ui-table__cell l-ui-table__cell--primary" scope="row"><code>include_blank:</code></th> |
| 174 | + <td class="l-ui-table__cell">Boolean / String</td> |
| 175 | + <td class="l-ui-table__cell">For <code>:select</code> fields. Defaults to <code>true</code>. Pass a string to use it as the blank option's label, or <code>false</code> to omit the blank option entirely.</td> |
| 176 | + </tr> |
165 | 177 | </tbody> |
166 | 178 | </table> |
167 | 179 | </div> |
0 commit comments