aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2007-02-01 18:06:16 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2007-02-01 18:06:16 +0000
commit593b1b837d24e61ea8f5386d66669585f3c14d5a (patch)
tree283c08f23cd86459d862125e774662820b300e20
parent416091d8b50ac855f175c004821a5d9831e21bd0 (diff)
downloadrails-593b1b837d24e61ea8f5386d66669585f3c14d5a.tar.gz
rails-593b1b837d24e61ea8f5386d66669585f3c14d5a.tar.bz2
rails-593b1b837d24e61ea8f5386d66669585f3c14d5a.zip
Ruby 1.8-cvs and 1.9 define a private Time#to_date that overrides Active Support. Make it public to preserve compatibility.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@6099 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--activesupport/CHANGELOG3
-rw-r--r--activesupport/lib/active_support/core_ext/time.rb10
-rw-r--r--activesupport/lib/active_support/core_ext/time/conversions.rb3
3 files changed, 13 insertions, 3 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index 007b61b755..9e21a8beab 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,5 +1,8 @@
*SVN*
+* Ruby 1.8-cvs and 1.9 define a private Time#to_date that overrides Active
+Support. Make it public to preserve compatibility. [Jeremy Kemper]
+
* Full test coverage for Inflector. #7228 [Dan Kubb]
* :db format for Date#to_s [Jeremy Kemper]
diff --git a/activesupport/lib/active_support/core_ext/time.rb b/activesupport/lib/active_support/core_ext/time.rb
index a802c065a7..a9e6a4385c 100644
--- a/activesupport/lib/active_support/core_ext/time.rb
+++ b/activesupport/lib/active_support/core_ext/time.rb
@@ -1,3 +1,13 @@
+require 'date'
+require 'time'
+
+# Ruby 1.8-cvs and 1.9 define private Time#to_date
+class Time
+ %w(to_date to_datetime).each do |method|
+ public method if private_instance_methods.include?(method)
+ end
+end
+
require File.dirname(__FILE__) + '/time/behavior'
require File.dirname(__FILE__) + '/time/calculations'
require File.dirname(__FILE__) + '/time/conversions'
diff --git a/activesupport/lib/active_support/core_ext/time/conversions.rb b/activesupport/lib/active_support/core_ext/time/conversions.rb
index 6e8dae21f1..f2ff0e06a8 100644
--- a/activesupport/lib/active_support/core_ext/time/conversions.rb
+++ b/activesupport/lib/active_support/core_ext/time/conversions.rb
@@ -1,6 +1,3 @@
-require 'date'
-require 'time'
-
module ActiveSupport #:nodoc:
module CoreExtensions #:nodoc:
module Time #:nodoc: