Changeset 8847
- Timestamp:
- 02/10/08 17:02:22 (7 months ago)
- Files:
-
- trunk/activerecord/CHANGELOG (modified) (1 diff)
- trunk/activerecord/lib/active_record/base.rb (modified) (1 diff)
- trunk/activesupport/CHANGELOG (modified) (1 diff)
- trunk/activesupport/lib/active_support/values/time_zone.rb (modified) (1 diff)
- trunk/activesupport/test/time_zone_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/activerecord/CHANGELOG
r8806 r8847 1 1 *SVN* 2 3 * Base#instantiate_time_object uses Time.zone.local() [Geoff Buesing] 2 4 3 5 * Add timezone-aware attribute readers and writers. #10982 [Geoff Buesing] trunk/activerecord/lib/active_record/base.rb
r8824 r8847 2476 2476 def instantiate_time_object(name, values) 2477 2477 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) 2479 2479 else 2480 2480 @@default_timezone == :utc ? Time.utc(*values) : Time.local(*values) trunk/activesupport/CHANGELOG
r8816 r8847 1 1 *SVN* 2 3 * TimeZone#new method renamed #local; when used with Time.zone, constructor now reads: Time.zone.local() [Geoff Buesing] 2 4 3 5 * 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 178 178 # Method for creating new ActiveSupport::TimeWithZone instance in time zone of self. Example: 179 179 # 180 # Time.zone = "Hawaii" # => "Hawaii"181 # Time.zone. new(2007, 2, 1, 15, 30, 45) # => Thu, 01 Feb 2007 15:30:45 HST -10:00182 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) 183 183 Time.utc_time(*args).change_time_zone(self) 184 184 end trunk/activesupport/test/time_zone_test.rb
r8806 r8847 130 130 end 131 131 132 def test_ new133 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) 134 134 assert_equal Time.utc(2007, 2, 5, 15, 30, 45), time.time 135 135 assert_equal TimeZone["Hawaii"], time.time_zone