diff options
author | Andrew White <andyw@pixeltrix.co.uk> | 2012-12-11 13:57:05 +0000 |
---|---|---|
committer | Andrew White <andyw@pixeltrix.co.uk> | 2012-12-11 13:57:05 +0000 |
commit | 48583f8bf74d1cefefea3cd6591bd546a9eaff6c (patch) | |
tree | 50ebc308bc70cddb151cf7ebdc375eaaae812fd1 /activerecord | |
parent | 45a6f546b6047befdef9d4acb8fa6c18cc0dab09 (diff) | |
download | rails-48583f8bf74d1cefefea3cd6591bd546a9eaff6c.tar.gz rails-48583f8bf74d1cefefea3cd6591bd546a9eaff6c.tar.bz2 rails-48583f8bf74d1cefefea3cd6591bd546a9eaff6c.zip |
Deprecate obsolete Time to DateTime fallback methods
The Time.time_with_datetime_fallback, Time.utc_time and Time.local_time
methods were added to handle the limitations of Ruby's native Time
implementation. Those limitations no longer apply so we are deprecating
them in 4.0 and they will be removed in 4.1.
Diffstat (limited to 'activerecord')
-rw-r--r-- | activerecord/lib/active_record/attribute_assignment.rb | 2 | ||||
-rw-r--r-- | activerecord/lib/active_record/connection_adapters/column.rb | 2 | ||||
-rw-r--r-- | activerecord/test/cases/date_time_test.rb | 6 |
3 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/attribute_assignment.rb b/activerecord/lib/active_record/attribute_assignment.rb index 6c5e2ac05d..ecfa556ab4 100644 --- a/activerecord/lib/active_record/attribute_assignment.rb +++ b/activerecord/lib/active_record/attribute_assignment.rb @@ -132,7 +132,7 @@ module ActiveRecord if object.class.send(:create_time_zone_conversion_attribute?, name, column) Time.zone.local(*set_values) else - Time.time_with_datetime_fallback(object.class.default_timezone, *set_values) + Time.send(object.class.default_timezone, *set_values) end end diff --git a/activerecord/lib/active_record/connection_adapters/column.rb b/activerecord/lib/active_record/connection_adapters/column.rb index 80984f39c9..df23dbfb60 100644 --- a/activerecord/lib/active_record/connection_adapters/column.rb +++ b/activerecord/lib/active_record/connection_adapters/column.rb @@ -240,7 +240,7 @@ module ActiveRecord # Treat 0000-00-00 00:00:00 as nil. return nil if year.nil? || (year == 0 && mon == 0 && mday == 0) - Time.time_with_datetime_fallback(Base.default_timezone, year, mon, mday, hour, min, sec, microsec) rescue nil + Time.send(Base.default_timezone, year, mon, mday, hour, min, sec, microsec) rescue nil end def fast_string_to_date(string) diff --git a/activerecord/test/cases/date_time_test.rb b/activerecord/test/cases/date_time_test.rb index 3deb0dac99..427076bd80 100644 --- a/activerecord/test/cases/date_time_test.rb +++ b/activerecord/test/cases/date_time_test.rb @@ -8,15 +8,15 @@ class DateTimeTest < ActiveRecord::TestCase with_active_record_default_timezone :utc do time_values = [1807, 2, 10, 15, 30, 45] # create DateTime value with local time zone offset - local_offset = Rational(Time.local_time(*time_values).utc_offset, 86400) + local_offset = Rational(Time.local(*time_values).utc_offset, 86400) now = DateTime.civil(*(time_values + [local_offset])) task = Task.new task.starting = now task.save! - # check against Time.local_time, since some platforms will return a Time instead of a DateTime - assert_equal Time.local_time(*time_values), Task.find(task.id).starting + # check against Time.local, since some platforms will return a Time instead of a DateTime + assert_equal Time.local(*time_values), Task.find(task.id).starting end end end |