internetee-registry/lib/gem_monkey_patches/i18n.rb
2021-01-14 20:23:22 +05:00

12 lines
375 B
Ruby

# Don't raise error when nil
# http://stackoverflow.com/questions/9467034/rails-i18n-how-to-handle-case-of-a-nil-date-being-passed-ie-lnil
module I18n
class << self
alias_method :original_localize, :localize
def localize(object, options = {})
options.merge!({ default: '-' })
object.present? ? original_localize(object, options) : ''
end
end
end