[LRUG] extending Time for use throughout rails

Dafydd Rees daf at dafydd.net
Fri Dec 28 10:41:41 PST 2007


Hello,

I want to add the concept of "geek format" (e.g. 2007-12-31) to the 
standard time class. This is how I do it:

class Time
   def geektime
     strftime('%Y-%m-%d')
   end
end

In what file (and where) should I put this code in my rails app so
it's accessible in all of my rails code?

The responsibilities should settle down soon and I can palm this work 
off to an object in one part of the system but until that happens I'd 
like to stash in in the Time class.

Cheers,
Dafydd
-- 
Dr Dafydd Rees
+44 (0)7968 486 880
http://www.dafydd.net



More information about the Chat mailing list