Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8847

Show
Ignore:
Timestamp:
02/10/08 17:02:22 (7 months ago)
Author:
gbuesing
Message:

TimeZone#new renamed #local, so that new TimeWithZone instances can be created via Time.zone.local()

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/CHANGELOG

    r8806 r8847  
    11*SVN* 
     2 
     3* Base#instantiate_time_object uses Time.zone.local() [Geoff Buesing] 
    24 
    35* Add timezone-aware attribute readers and writers. #10982 [Geoff Buesing] 
  • trunk/activerecord/lib/active_record/base.rb

    r8824 r8847  
    24762476      def instantiate_time_object(name, values) 
    24772477        if Time.zone && !self.class.skip_time_zone_conversion_for_attributes.include?(name.to_sym) 
    2478           Time.zone.new(*values) 
     2478          Time.zone.local(*values) 
    24792479        else 
    24802480          @@default_timezone == :utc ? Time.utc(*values) : Time.local(*values) 
  • trunk/activesupport/CHANGELOG

    r8816 r8847  
    11*SVN* 
     2 
     3* TimeZone#new method renamed #local; when used with Time.zone, constructor now reads: Time.zone.local() [Geoff Buesing] 
    24 
    35* Added Base64.encode64s to encode values in base64 without the newlines. This makes the values immediately usable as URL parameters or memcache keys without further processing [DHH] 
  • trunk/activesupport/lib/active_support/values/time_zone.rb

    r8806 r8847  
    178178  # Method for creating new ActiveSupport::TimeWithZone instance in time zone of self. Example: 
    179179  # 
    180   #   Time.zone = "Hawaii"                    # => "Hawaii" 
    181   #   Time.zone.new(2007, 2, 1, 15, 30, 45)   # => Thu, 01 Feb 2007 15:30:45 HST -10:00 
    182   def new(*args) 
     180  #   Time.zone = "Hawaii"                      # => "Hawaii" 
     181  #   Time.zone.local(2007, 2, 1, 15, 30, 45)   # => Thu, 01 Feb 2007 15:30:45 HST -10:00 
     182  def local(*args) 
    183183    Time.utc_time(*args).change_time_zone(self) 
    184184  end 
  • trunk/activesupport/test/time_zone_test.rb

    r8806 r8847  
    130130  end  
    131131   
    132   def test_new 
    133     time = TimeZone["Hawaii"].new(2007, 2, 5, 15, 30, 45) 
     132  def test_local 
     133    time = TimeZone["Hawaii"].local(2007, 2, 5, 15, 30, 45) 
    134134    assert_equal Time.utc(2007, 2, 5, 15, 30, 45), time.time 
    135135    assert_equal TimeZone["Hawaii"], time.time_zone