aboutsummaryrefslogtreecommitdiffstats
path: root/actionview
diff options
context:
space:
mode:
authorGodfrey Chan <godfreykfc@gmail.com>2013-09-27 12:51:36 -0700
committerGodfrey Chan <godfreykfc@gmail.com>2013-11-26 22:24:19 -0800
commit1f1613604925823be4b15893fbb8f957a38dd0b8 (patch)
treee80aee6332bcd19c5f969151e9f667b919558d5b /actionview
parent5fdbec7dd15a8e6edef861899accb8b3b69cc87a (diff)
downloadrails-1f1613604925823be4b15893fbb8f957a38dd0b8.tar.gz
rails-1f1613604925823be4b15893fbb8f957a38dd0b8.tar.bz2
rails-1f1613604925823be4b15893fbb8f957a38dd0b8.zip
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`. Also fixed & refactor the test cases for Numeric#{ago,since} and AS::Duration#{ago,since}. The original test case had the assertion flipped and the purpose of the test wasn't very clear.
Diffstat (limited to 'actionview')
0 files changed, 0 insertions, 0 deletions