Don't evaluate a conditional and assign a variable on the same line
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user