diff options
author | Godfrey Chan <godfreykfc@gmail.com> | 2013-09-27 12:51:36 -0700 |
---|---|---|
committer | Godfrey Chan <godfreykfc@gmail.com> | 2013-11-26 22:24:19 -0800 |
commit | 1f1613604925823be4b15893fbb8f957a38dd0b8 (patch) | |
tree | e80aee6332bcd19c5f969151e9f667b919558d5b /activerecord/test/fixtures/collections.yml | |
parent | 5fdbec7dd15a8e6edef861899accb8b3b69cc87a (diff) | |
download | rails-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 'activerecord/test/fixtures/collections.yml')
0 files changed, 0 insertions, 0 deletions