aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/CHANGELOG.md
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2013-11-27 03:47:35 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2013-11-27 03:47:35 -0700
commitd4016f24fb5266b361f44da66de445abfbb086e1 (patch)
tree2c720707a0ac44a953384e5f4641309749ef4fa2 /activesupport/CHANGELOG.md
parentf15bd23fdeabd7ca745bc6f4a77d36ef4aa606fd (diff)
parent1f1613604925823be4b15893fbb8f957a38dd0b8 (diff)
downloadrails-d4016f24fb5266b361f44da66de445abfbb086e1.tar.gz
rails-d4016f24fb5266b361f44da66de445abfbb086e1.tar.bz2
rails-d4016f24fb5266b361f44da66de445abfbb086e1.zip
Merge branch 'deprecate_numeric_since_ago' of https://github.com/chancancode/rails
Conflicts: activesupport/CHANGELOG.md
Diffstat (limited to 'activesupport/CHANGELOG.md')
-rw-r--r--activesupport/CHANGELOG.md17
1 files changed, 17 insertions, 0 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md
index 09cee39bca..37879760a6 100644
--- a/activesupport/CHANGELOG.md
+++ b/activesupport/CHANGELOG.md
@@ -1,3 +1,20 @@
+* Deprecated Numeric#{ago,until,since,from_now}, the user is expected to explicitly
+ convert the value into an AS::Duration, i.e. 5.ago => 5.seconds.ago
+
+ This will help to catch subtle bugs like:
+
+ def recent?(days = 3)
+ self.created_at >= days.ago
+ end
+
+ The above code would check if the model is created within the last 3 **seconds**.
+
+ In the future, Numeric#{ago,until,since,from_now} should be removed completely,
+ or throw some sort of errors to indicate there are no implicit conversion from
+ Numeric to AS::Duration.
+
+ *Godfrey Chan*
+
* Requires JSON gem version 1.7.7 or above due to a security issue in older versions.
*Godfrey Chan*