Sorry, problem with my system and a recent upgrade; you're right.

On Sep 22, 2009, at 2:12 AM, Ohad Levy wrote:

>
> thats strange:
>
> irb
> irb(main):001:0> require 'rubygems'
> => true
> irb(main):002:0> require 'active_record'
> => true
> irb(main):003:0> require 'active_record/version'
> => []
> irb(main):004:0> ::ActiveRecord::VERSION::MAJOR
> => 2
> irb(main):005:0> ::ActiveRecord::VERSION::MINOR
> => 3
> irb(main):006:0> Time.zone = "UTC"
> => "UTC"
> irb(main):007:0> ActiveRecord::Base.time_zone_aware_attributes = true
> => true
> irb(main):008:0> ActiveRecord::Base.default_timezone = "UTC"
> => "UTC"
>
>
> On 9/18/09, Luke Kanies <[email protected]> wrote:
>>
>> We already require 2.1 or better, and I'm running 2.3.something.
>>
>>
>> On Sep 17, 2009, at 6:58 PM, Ohad Levy wrote:
>>
>>> As far as I understand, it was introduced in Rails 2.1 (seems to be
>>> working on my 2.1 version).
>>>
>>> maybe add ::ActiveRecord::VERSION::MINOR >= 1 before the whole
>>> statement?
>>>
>>> Ohad
>>> On 9/18/09, Luke Kanies <[email protected]> wrote:
>>> Hmm.  I just tried this in irb, and I don't even have a 'zone='  
>>> method
>>> on Time, even after loading active_record.
>>>
>>> Do you know where this method comes from?
>>>
>>>
>>> On Sep 16, 2009, at 6:46 PM, Ohad Levy wrote:
>>>
>>>> as far as I can understand from the rails code, that would only be
>>>> valid to AR, as Time.zone will return ActiveSupport::TimeZone
>>>> object, but Time.now still returns local time.
>>>>
>>>> On 9/17/09, Luke Kanies <[email protected]> wrote:
>>>> But you've got 'Time.zone = "UTC"', which is global behaviour,
>>> right?
>>>>
>>>>
>>>> On Sep 16, 2009, at 6:24 PM, Ohad Levy wrote:
>>>>
>>>>> The way I understand the problem is that all time object when
>>> saved
>>>>> into a database lose their timezone properties.
>>>>> this patch, make AR aware of timezones, and ensures that it does
>>> the
>>>>> right conversions when storing time objects for example:
>>>>> if you save last_compile in local time, AR will store it as utc,
>>> but
>>>>> when you read it AR will return a time object with local time zone
>>>>> offset.
>>>>>
>>>>> this is important when you share your database with other
>>>>> applications, where they expect all datetime objects to be in UTC.
>>>>> This does not change any other behavior of writing time in other
>>>>> places - e.g. your yaml files will still contain the timezone
>>>>> information as they are a dump of Time objects.
>>>>>
>>>>> Ohad
>>>>>
>>>>> On 9/17/09, Luke Kanies <[email protected]> wrote:
>>>>> How does this affect the rest of the system?  It sets the TZ to
>>> UTC
>>>>> for everything, right?
>>>>>
>>>>> I know we should be doing this anyway, but if so we need to do
>>> so as
>>>>> part of a more obvious effort, rather than just as a Rails fix.
>>>>>
>>>>> On Sep 16, 2009, at 6:13 AM, Ohad Levy wrote:
>>>>>
>>>>>> 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
>>>>>>
>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> One of the Ten Commandments for Technicians:
>>>>>     (7) Work thou not on energized equipment, for if thou dost,
>>> thy
>>>>>     fellow workers will surely buy beers for thy widow and
>>>>>     console her in other ways.
>>>>>
>>>>
>>> ---------------------------------------------------------------------
>>>>> Luke Kanies | http://reductivelabs.com | http://madstop.com
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>>
>>>>
>>>>
>>>> --
>>>>
>>>> At my lemonade stand I used to give the first glass away free and
>>>> charge
>>>> five dollars for the second glass. The refill contained the
>>> antidote.
>>>>     -- Emo Phillips
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>>> Luke Kanies | http://reductivelabs.com | http://madstop.com
>>>>
>>>>
>>>>
>>>>>
>>>
>>>
>>> --
>>>
>>> Barondes' First Law:
>>>     Science abhors contradictions; scientists' minds are replete  
>>> with
>>>     them.
>>>
>>> ---------------------------------------------------------------------
>>> Luke Kanies | http://reductivelabs.com | http://madstop.com
>>>
>>>
>>>
>>>
>>>>
>>
>>
>> --
>>
>> The secret of being a bore is to tell everything. -- Voltaire
>>
>> ---------------------------------------------------------------------
>> Luke Kanies | http://reductivelabs.com | http://madstop.com
>>
>>
>>>
>>
>
> >


-- 
Some people are afraid of heights. I'm afraid of widths.
     -- Stephen Wright
---------------------------------------------------------------------
Luke Kanies | http://reductivelabs.com | http://madstop.com


--~--~---------~--~----~------------~-------~--~----~
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