aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/CHANGELOG3
-rw-r--r--activesupport/lib/active_support/core_ext/numeric/time.rb7
2 files changed, 9 insertions, 1 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index 12692c659c..ce3df8969c 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,5 +1,8 @@
*SVN*
+* Added a note to the documentation for the Date related Numeric extensions to indicate that they're
+approximations and shouldn't be used for critical calculations. [Koz]
+
* Added Hash#to_xml and Array#to_xml that makes it much easier to produce XML from basic structures [DHH]. Examples:
{ :name => "David", :street_name => "Paulina", :age => 26, :moved_on => Date.new(2005, 11, 15) }.to_xml
diff --git a/activesupport/lib/active_support/core_ext/numeric/time.rb b/activesupport/lib/active_support/core_ext/numeric/time.rb
index de726281b8..a69a6c5f64 100644
--- a/activesupport/lib/active_support/core_ext/numeric/time.rb
+++ b/activesupport/lib/active_support/core_ext/numeric/time.rb
@@ -1,7 +1,12 @@
module ActiveSupport #:nodoc:
module CoreExtensions #:nodoc:
module Numeric #:nodoc:
- # Enables the use of time calculations and declarations, like 45.minutes + 2.hours + 4.years
+ # Enables the use of time calculations and declarations, like 45.minutes + 2.hours + 4.years.
+ #
+ # Some of these methods are approximations, Ruby's core
+ # Date[http://stdlib.rubyonrails.org/libdoc/date/rdoc/index.html] and
+ # Time[http://stdlib.rubyonrails.org/libdoc/time/rdoc/index.html] should be used for precision
+ # date and time arithmetic
module Time
def minutes
self * 60