diff options
author | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-08-11 14:04:21 -0300 |
---|---|---|
committer | Carlos Antonio da Silva <carlosantoniodasilva@gmail.com> | 2012-08-11 14:04:22 -0300 |
commit | e8e8617c390776e6d7b21ca79b99503a8afb19ae (patch) | |
tree | b4ab786784a97efb6d8ba7a48f233f444cb2f75c /actionpack/lib/action_view | |
parent | ce06b8a56c5647b9b963c2331e3912fbc54e950c (diff) | |
download | rails-e8e8617c390776e6d7b21ca79b99503a8afb19ae.tar.gz rails-e8e8617c390776e6d7b21ca79b99503a8afb19ae.tar.bz2 rails-e8e8617c390776e6d7b21ca79b99503a8afb19ae.zip |
Simplify html attributes generation for options_for_select
Further simplify the option_html_attributes method after the changes
introduced in dacbcbe55745aa9e5484b10b11f65ccca7db1c54 to not escape the
html options here (since they're going to be escaped down the chain in
content tag).
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r-- | actionpack/lib/action_view/helpers/form_options_helper.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/helpers/form_options_helper.rb b/actionpack/lib/action_view/helpers/form_options_helper.rb index f3237f82d5..775993fe03 100644 --- a/actionpack/lib/action_view/helpers/form_options_helper.rb +++ b/actionpack/lib/action_view/helpers/form_options_helper.rb @@ -708,9 +708,11 @@ module ActionView private def option_html_attributes(element) - return {} unless Array === element - - Hash[element.select { |e| Hash === e }.reduce({}, :merge).map { |k, v| [k, v] }] + if Array === element + element.select { |e| Hash === e }.reduce({}, :merge) + else + {} + end end def option_text_and_value(option) |