Friday, June 20, 2014

Rails override Time.now to return Time.zone.now

In initializer, add this:


class << Time
alias :system_now :now
def now
ActiveSupport::TimeWithZone.new(self.system_now.utc, Time.zone)
end
end

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.