Skip to content

Commit

Permalink
Merge pull request #32326 from q-centrix/perf-improvement-translation…
Browse files Browse the repository at this point in the history
…-helper-default-array

Only create an array with default options if we have default options
  • Loading branch information
guilleiguaran committed Apr 18, 2018
2 parents 0ac549a + 3852605 commit 7bcb04c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion actionview/lib/action_view/helpers/translation_helper.rb
Expand Up @@ -60,7 +60,11 @@ module TranslationHelper
def translate(key, options = {})
options = options.dup
has_default = options.has_key?(:default)
remaining_defaults = Array(options.delete(:default)).compact
if has_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
Expand Down

0 comments on commit 7bcb04c

Please sign in to comment.