diff options
author | Vasiliy Ermolovich <younash@gmail.com> | 2012-02-18 14:35:28 +0300 |
---|---|---|
committer | Vasiliy Ermolovich <younash@gmail.com> | 2012-02-18 14:35:28 +0300 |
commit | ac2e801cd24be41fbcadc447214a0aa0b120561a (patch) | |
tree | 5897bad65767563d4d44b82511504ad908a7c4db /actionpack/lib | |
parent | 2f689d462d8e94365724c5575b14ab997e11bb43 (diff) | |
download | rails-ac2e801cd24be41fbcadc447214a0aa0b120561a.tar.gz rails-ac2e801cd24be41fbcadc447214a0aa0b120561a.tar.bz2 rails-ac2e801cd24be41fbcadc447214a0aa0b120561a.zip |
add selected and disabled option to grouped select
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/tags/grouped_collection_select.rb | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/tags/grouped_collection_select.rb b/actionpack/lib/action_view/helpers/tags/grouped_collection_select.rb index 507466a57a..507ba8835f 100644 --- a/actionpack/lib/action_view/helpers/tags/grouped_collection_select.rb +++ b/actionpack/lib/action_view/helpers/tags/grouped_collection_select.rb @@ -14,8 +14,13 @@ module ActionView end def render + option_tags_options = { + :selected => @options.fetch(:selected) { value(@object) }, + :disabled => @options[:disabled] + } + select_content_tag( - option_groups_from_collection_for_select(@collection, @group_method, @group_label_method, @option_key_method, @option_value_method, value(@object)), @options, @html_options + option_groups_from_collection_for_select(@collection, @group_method, @group_label_method, @option_key_method, @option_value_method, option_tags_options), @options, @html_options ) end end |