diff options
author | José Valim <jose.valim@plataformatec.com.br> | 2012-02-20 04:20:59 -0800 |
---|---|---|
committer | José Valim <jose.valim@plataformatec.com.br> | 2012-02-20 04:20:59 -0800 |
commit | b62f5a9a3a76243c0b233ecb497d56cb3c3c7c76 (patch) | |
tree | ad28e3411f34f61ed349772e9e2a75a5feaa30ee /actionpack/lib/action_view/helpers | |
parent | e1c381603d277bc4d6cb430d53a5f1d1aca377e7 (diff) | |
parent | ac2e801cd24be41fbcadc447214a0aa0b120561a (diff) | |
download | rails-b62f5a9a3a76243c0b233ecb497d56cb3c3c7c76.tar.gz rails-b62f5a9a3a76243c0b233ecb497d56cb3c3c7c76.tar.bz2 rails-b62f5a9a3a76243c0b233ecb497d56cb3c3c7c76.zip |
Merge pull request #5083 from nashby/grouped-select-options
add selected and disabled options to grouped select
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-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 |