aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides/source/active_support_core_extensions.textile
diff options
context:
space:
mode:
authorMatt Bridges <mbridges.91@gmail.com>2012-01-03 19:53:13 -0600
committerMatt Bridges <mbridges.91@gmail.com>2012-02-21 16:27:08 -0600
commitd6366625e04c516bf5f4bd6f561c3bb1945b0c82 (patch)
tree34c9ada6ee0e422235ec3cfeed7439806ebdfa50 /railties/guides/source/active_support_core_extensions.textile
parent7cfd1bd76a41bea528c945d821a9fbc3902af479 (diff)
downloadrails-d6366625e04c516bf5f4bd6f561c3bb1945b0c82.tar.gz
rails-d6366625e04c516bf5f4bd6f561c3bb1945b0c82.tar.bz2
rails-d6366625e04c516bf5f4bd6f561c3bb1945b0c82.zip
Adding :last_week, :last_month, and :last_year aliases to Time and Date
core extensions
Diffstat (limited to 'railties/guides/source/active_support_core_extensions.textile')
-rw-r--r--railties/guides/source/active_support_core_extensions.textile18
1 files changed, 12 insertions, 6 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile
index 1c82a2941f..3983667c2b 100644
--- a/railties/guides/source/active_support_core_extensions.textile
+++ b/railties/guides/source/active_support_core_extensions.textile
@@ -2858,6 +2858,8 @@ d.next_year # => Wed, 28 Feb 2001
Active Support defines these methods as well for Ruby 1.8.
++prev_year+ is aliased to +last_year+.
+
h6. +prev_month+, +next_month+
In Ruby 1.9 +prev_month+ and +next_month+ return the date with the same day in the last or next month:
@@ -2879,6 +2881,8 @@ Date.new(2000, 1, 31).next_month # => Tue, 29 Feb 2000
Active Support defines these methods as well for Ruby 1.8.
++prev_month+ is aliased to +last_month+.
+
h6. +beginning_of_week+, +end_of_week+
The methods +beginning_of_week+ and +end_of_week+ return the dates for the
@@ -2924,6 +2928,8 @@ d.prev_week(:saturday) # => Sat, 01 May 2010
d.prev_week(:friday) # => Fri, 30 Apr 2010
</ruby>
++prev_week+ is aliased to +last_week+.
+
h6. +beginning_of_month+, +end_of_month+
The methods +beginning_of_month+ and +end_of_month+ return the dates for the beginning and end of the month:
@@ -3134,13 +3140,13 @@ end_of_week (at_end_of_week)
monday
sunday
weeks_ago
-prev_week
+prev_week (last_week)
next_week
months_ago
months_since
beginning_of_month (at_beginning_of_month)
end_of_month (at_end_of_month)
-prev_month
+prev_month (last_month)
next_month
beginning_of_quarter (at_beginning_of_quarter)
end_of_quarter (at_end_of_quarter)
@@ -3148,7 +3154,7 @@ beginning_of_year (at_beginning_of_year)
end_of_year (at_end_of_year)
years_ago
years_since
-prev_year
+prev_year (last_year)
next_year
</ruby>
@@ -3310,13 +3316,13 @@ end_of_week (at_end_of_week)
monday
sunday
weeks_ago
-prev_week
+prev_week (last_week)
next_week
months_ago
months_since
beginning_of_month (at_beginning_of_month)
end_of_month (at_end_of_month)
-prev_month
+prev_month (last_month)
next_month
beginning_of_quarter (at_beginning_of_quarter)
end_of_quarter (at_end_of_quarter)
@@ -3324,7 +3330,7 @@ beginning_of_year (at_beginning_of_year)
end_of_year (at_end_of_year)
years_ago
years_since
-prev_year
+prev_year (last_year)
next_year
</ruby>