diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG index ee8afe427e76d296955905b16070ea427d8b729a..cc0bdf658629ef8e27b1b9ce0c386640a89890d3 100644 --- a/activesupport/CHANGELOG +++ b/activesupport/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Fixed Time#last_year to go back in time, not forward #1278 [fabien@odilat.com] + * Fixed the pluralization of analysis to analyses #1295 [seattle@rootimage.msu.edu] * Fixed that Time.local(2005,12).months_since(1) would raise "ArgumentError: argument out of range" #1311 [jhahn@niveon.com] diff --git a/activesupport/lib/active_support/core_ext/time/calculations.rb b/activesupport/lib/active_support/core_ext/time/calculations.rb index f238ca168a831f32aae45420625cc8849a9bea4e..1c9a3523a97c07492a4851fa53d856791680ccb1 100644 --- a/activesupport/lib/active_support/core_ext/time/calculations.rb +++ b/activesupport/lib/active_support/core_ext/time/calculations.rb @@ -64,12 +64,12 @@ def years_since(years) change(:year => self.year + years) end - # Short-hand for months_ago(1) + # Short-hand for years_ago(1) def last_year - years_since(1) + years_ago(1) end - # Short-hand for months_since(1) + # Short-hand for years_since(1) def next_year years_since(1) end diff --git a/activesupport/test/core_ext/time_ext_test.rb b/activesupport/test/core_ext/time_ext_test.rb index 6bad622386265a19c8ba07b23675284c203a2249..18ae3219bc397f223686bcc2ddd71372543c3cf8 100644 --- a/activesupport/test/core_ext/time_ext_test.rb +++ b/activesupport/test/core_ext/time_ext_test.rb @@ -56,6 +56,10 @@ def test_years_since # Failure because of size limitations of numeric? # assert_equal Time.local(2182,6,5,10), Time.local(2005,6,5,10,0,0).years_since(177) end + + def test_last_year + assert_equal Time.local(2004,6,5,10), Time.local(2005,6,5,10,0,0).last_year + end def test_ago