diff options
author | Max Melentiev <melentievm@gmail.com> | 2018-04-28 10:42:19 +0300 |
---|---|---|
committer | Max Melentiev <melentievm@gmail.com> | 2018-04-28 10:42:19 +0300 |
commit | 20b4794ff7a77216fade68af8b1a0b54164b0c38 (patch) | |
tree | 5edb56017104884d46f685207367751c9ab73369 /actionview | |
parent | 276fe661098619239ac90c110b06d72b3fc77b5c (diff) | |
download | rails-20b4794ff7a77216fade68af8b1a0b54164b0c38.tar.gz rails-20b4794ff7a77216fade68af8b1a0b54164b0c38.tar.bz2 rails-20b4794ff7a77216fade68af8b1a0b54164b0c38.zip |
Don't allocate unnecessary array in translation helper
Diffstat (limited to 'actionview')
-rw-r--r-- | actionview/lib/action_view/helpers/translation_helper.rb | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/actionview/lib/action_view/helpers/translation_helper.rb b/actionview/lib/action_view/helpers/translation_helper.rb index db44fdbfee..d3cdab0d2f 100644 --- a/actionview/lib/action_view/helpers/translation_helper.rb +++ b/actionview/lib/action_view/helpers/translation_helper.rb @@ -59,15 +59,9 @@ module ActionView # they can provide HTML values for. def translate(key, options = {}) options = options.dup - has_default = options.has_key?(:default) - if has_default + if options.has_key?(:default) remaining_defaults = Array(options.delete(:default)).compact - else - remaining_defaults = [] - end - - if has_default && !remaining_defaults.first.kind_of?(Symbol) - options[:default] = remaining_defaults + options[:default] = remaining_defaults unless remaining_defaults.first.kind_of?(Symbol) end # If the user has explicitly decided to NOT raise errors, pass that option to I18n. |