Don't evaluate a conditional and assign a variable on the same line

This commit is contained in:
Angel Perez
2018-07-20 15:29:34 -04:00
parent f92006b3f3
commit bc152acaf2

View File

@@ -7,15 +7,19 @@ module ActionView
include TagHelper
def t(key, options = {})
if translation = I18nContent.by_key(key).last
translation = I18nContent.by_key(key).last
if translation.present?
Globalize.with_locale(locale) do
string = I18nContent.where(key: key).first.value
options.each do |key, value|
string.sub! "%{#{key}}", (value || "%{#{key}}")
end
return string.html_safe
end
end
translate(key, options)
end
end