I's all in the title!
I find it very painful, to always have to supply a date so that I18n.l doesn't miserably fail. Why doesn't simply return ""???
I's all in the title!
I find it very painful, to always have to supply a date so that I18n.l doesn't miserably fail. Why doesn't simply return ""???
Because that's how it's coded.
def localize(locale, object, format = :default) raise ArgumentError, "Object must be a Date, DateTime or Time object. #{object.inspect} given." unless object.respond_to?(:strftime)
If you find yourself repeatedly doing something then your code is not DRY. The solution might be to provide your own wrapper and call that.
Colin