diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-01-31 18:38:46 -0200 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-02-02 09:40:23 -0200 |
commit | 595271cbd2a763103223026b893a4ca3c98978c7 (patch) | |
tree | 1e14ede3bfb9a9b87b11d338d73065f68300e40f | |
parent | d9fc3dc4f1953710bf6f8001cc2e7504fcd59118 (diff) | |
download | rails-595271cbd2a763103223026b893a4ca3c98978c7.tar.gz rails-595271cbd2a763103223026b893a4ca3c98978c7.tar.bz2 rails-595271cbd2a763103223026b893a4ca3c98978c7.zip |
Refactor option groups to use content_tag
[Carlos Antonio da Silva + Rafael Mendonça França]
-rw-r--r-- | actionpack/lib/action_view/helpers/form_options_helper.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index c4cdfef4a2..75ffb0d282 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -418,10 +418,10 @@ module ActionView # wrap the output in an appropriate <tt><select></tt> tag. def option_groups_from_collection_for_select(collection, group_method, group_label_method, option_key_method, option_value_method, selected_key = nil) collection.map do |group| - group_label_string = group.send(group_label_method) - "<optgroup label=\"#{ERB::Util.html_escape(group_label_string)}\">" + - options_from_collection_for_select(group.send(group_method), option_key_method, option_value_method, selected_key) + - '</optgroup>' + option_tags = options_from_collection_for_select( + group.send(group_method), option_key_method, option_value_method, selected_key) + + content_tag(:optgroup, option_tags, :label => group.send(group_label_method)) end.join.html_safe end |