timpone
timpone

Reputation: 19969

rails timestamp in both local server time and utc time / t.timestamps

I'm curious if anyone has overriden the t.timestamps in rails migrations to provide both a local time and a utc time. Like:

updated_at
created_at
updated_at_utc
created_at_utc

Part of me thinks this is a really bad idea but if easily done would satisfy some internal complaints. I'm also thinking of nixing t.timestamps since we use paper clip and have the information there too.

I know we could do calculations but it would be nice to have both pieces of info there when accessing via MySQL. The business case is that 90% of our stuff takes place in our time zone and 10% outside time zone.

How would I override this?

thx

Upvotes: 0

Views: 297

Answers (1)

klochner
klochner

Reputation: 8125

just set the utc fields in a before_save callback.

Upvotes: 1

Related Questions