Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Ticket #9863 (closed enhancement: fixed)

Opened 9 months ago

Last modified 9 months ago

[PATCH] Refactoring Time and Date #months_since and #months_ago to use #advance

Reported by: gbuesing Assigned to: core
Priority: normal Milestone: 2.x
Component: ActiveSupport Version: edge
Severity: normal Keywords:
Cc:

Description

This patch refactors Time and Date #months_since to use #advance, instead of relying on its own logic to do this.

Existing tests pass, and I've added some additional tests to document some edge cases around advancing from the end of the month to a month with fewer days (these tests pass with both old and new code.)

I also added some docs for Time and Date #months_since and #years_since, which didn't have any.

Attachments

months_since_and_ago_uses_advance.diff (5.6 kB) - added by gbuesing on 10/13/07 15:57:41.
months_since_and_ago_uses_advance_from_rails_root.diff (5.8 kB) - added by danger on 10/13/07 19:45:25.
exact same patch as above but recreated from root dir

Change History

10/13/07 15:57:41 changed by gbuesing

  • attachment months_since_and_ago_uses_advance.diff added.

10/13/07 19:45:25 changed by danger

  • attachment months_since_and_ago_uses_advance_from_rails_root.diff added.

exact same patch as above but recreated from root dir

10/13/07 19:46:24 changed by danger

+1

Great work - I really like to see so much code get removed. I recreated the patch from the root directory so it applies cleanly to trunk.

10/13/07 20:12:41 changed by bitsweat

  • status changed from new to closed.
  • resolution set to fixed.

(In [7862]) Refactor Time and Date#months_since and #months_ago to use #advance. Closes #9863.

10/13/07 23:44:45 changed by rmm5t

+1 Code removal is the best kind of refactor

10/13/07 23:46:47 changed by rmm5t

Whoops. Sorry, I must have looked at a cached version of the page before submitting the +1.