diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-21 14:51:10 +0000 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2005-02-21 14:51:10 +0000 |
commit | b08f35309bbec4b309ff614b30ff45f6c7309d40 (patch) | |
tree | 314261c0ad37dac48e0407847ee4fc8a55b268af | |
parent | 25f8a25c3ea107dcd0688307ac0ce19c4306f6b4 (diff) | |
download | rails-b08f35309bbec4b309ff614b30ff45f6c7309d40.tar.gz rails-b08f35309bbec4b309ff614b30ff45f6c7309d40.tar.bz2 rails-b08f35309bbec4b309ff614b30ff45f6c7309d40.zip |
Added last_month and next_month
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@734 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | activesupport/lib/active_support/core_ext/time/calculations.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb index c62a2447e8..3ebfa125be 100644 --- a/activesupport/lib/active_support/core_ext/time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/time/calculations.rb @@ -53,6 +53,16 @@ module ActiveSupport #:nodoc: 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 |