mirror of
https://github.com/internetee/registry.git
synced 2025-06-05 04:07:33 +02:00
12 lines
377 B
Ruby
12 lines
377 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
|