ActionView::Helpers::FormOptionsHelper
option_groups_from_collection_for_select
API docs (Rails 8.1.4.1) ↗def option_groups_from_collection_for_select(collection, group_method, group_label_method, option_key_method, option_value_method, selected_key = nil)
Description
Creates an <optgroup> for each item in collection, containing its <option> elements.
ERB
Changes from the previous output: Added Removed Changed
HTML
Preview
Interacting with the preview updates the form submission.
Form submission
Form data
| name | value |
|---|
Request body
Content-Type:
params