plataformatec/simple_form — Issue #459: `selected_key` option does not work on `grouped_select`
Author: patrickberkeley
Created: 2012-02-18 05:41:13+00:00
State: open

**Issue:** The `selected` or `selected_key` option doesn't work on a `grouped_select` input.

**Example**

```erb
<%= f.input :object,
collection: my_collection,
as: :grouped_select,
group_method: :collection_object,
group_label_method: :name,
value_method: :id,
label_method: :name,
selected_key: params[:collection_object_id],
input_html: {name: :collection_object_id, id: "collection_object_id"},
include_blank: true
%>
```

The above results in no option ever being selected even when its value matches the params.