lib/active_scaffold/extensions/localize.rb in active_scaffold-3.6.0.pre vs lib/active_scaffold/extensions/localize.rb in active_scaffold-3.6.0.rc1
- old
+ new
@@ -1,8 +1,10 @@
class Object
def as_(key, options = {})
if key.present?
- text = I18n.translate(key.to_s, {:scope => [:active_scaffold, *options.delete(:scope)], :default => key.is_a?(String) ? key : key.to_s.titleize}.merge(options)).html_safe
+ scope = [:active_scaffold, *options.delete(:scope)]
+ options = options.reverse_merge(:scope => scope, :default => key.is_a?(String) ? key : key.to_s.titleize)
+ text = I18n.translate(key.to_s, options).html_safe # rubocop:disable Rails/OutputSafety
# text = nil if text.include?('translation missing:')
end
text || key
end
end