From cadfe4bf452e5ae1f4e54a01709f6eba6eb17dc2 Mon Sep 17 00:00:00 2001 From: Vasiliy Ermolovich Date: Sat, 20 Jul 2013 15:36:27 +0300 Subject: add support for html attributes to grouped_options_for_select --- actionview/lib/action_view/helpers/form_options_helper.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'actionview/lib') diff --git a/actionview/lib/action_view/helpers/form_options_helper.rb b/actionview/lib/action_view/helpers/form_options_helper.rb index 4e9ef94ff3..8351548f06 100644 --- a/actionview/lib/action_view/helpers/form_options_helper.rb +++ b/actionview/lib/action_view/helpers/form_options_helper.rb @@ -520,12 +520,16 @@ module ActionView end grouped_options.each do |container| + html_attributes = option_html_attributes(container) + if divider label = divider else label, container = container end - body.safe_concat content_tag(:optgroup, options_for_select(container, selected_key), :label => label) + + html_attributes = { :label => label }.merge(html_attributes) + body.safe_concat content_tag(:optgroup, options_for_select(container, selected_key), html_attributes) end body -- cgit v1.2.3