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 ""??? -- Posted via http://www.ruby-forum.com/.
Because that''s how it''s coded. from: I18n::Backend.localize... 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) On Oct 12, 4:20 pm, Fernando Perez <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> 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 ""??? > -- > Posted viahttp://www.ruby-forum.com/.
2009/10/12 Fernando Perez <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > 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 ""???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