>From 1368df476535169785812c2f6400f84a4f5064bc Mon Sep 17 00:00:00 2001
From: Ohad Levy <[email protected]>
Date: Wed, 16 Sep 2009 21:08:23 +0800
Subject: [PATCH/puppet 1/1] fixes #2518 - This defaults all datetime fields
in ActiveRecord to store in UTC vs the puppetmaster localtime
Signed-off-by: Ohad Levy <[email protected]>

---
 lib/puppet/rails.rb |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/lib/puppet/rails.rb b/lib/puppet/rails.rb
index fc8eacd..c8e9947 100644
--- a/lib/puppet/rails.rb
+++ b/lib/puppet/rails.rb
@@ -22,6 +22,12 @@ module Puppet::Rails
             ActiveRecord::Base.logger.level = Logger::DEBUG
         end

+        # Ensure that Active Record uses UTC to store datetime
+        # fixes #2518
+        Time.zone = "UTC"
+        ActiveRecord::Base.time_zone_aware_attributes = true
+        ActiveRecord::Base.default_timezone = "UTC"
+
         ActiveRecord::Base.verify_active_connections!

         begin
-- 
1.6.0.4

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to