Permalink
Browse files

Added last_month and next_month

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@734 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 25f8a25 commit b08f35309bbec4b309ff614b30ff45f6c7309d40 @dhh dhh committed Feb 21, 2005
Showing with 10 additions and 0 deletions.
  1. +10 −0 activesupport/lib/active_support/core_ext/time/calculations.rb
@@ -53,6 +53,16 @@ def months_since(months)
end
end
+ # Short-hand for months_ago(1)
+ def last_month
+ months_ago(1)
+ end
+
+ # Short-hand for months_since(1)
+ def next_month
+ months_since(1)
+ end
+
# Returns a new Time representing the "start" of this week (Monday, 0:00)
def beginning_of_week
(self - self.wday.days).midnight + 1.day

0 comments on commit b08f353

Please sign in to comment.