Changeset 4993
- Timestamp:
- 09/04/06 19:23:07 (2 years ago)
- Files:
-
- trunk/actionpack/CHANGELOG (modified) (1 diff)
- trunk/actionpack/lib/action_view/helpers/text_helper.rb (modified) (1 diff)
- trunk/actionpack/test/template/text_helper_test.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/actionpack/CHANGELOG
r4989 r4993 1 1 *SVN* 2 3 * Fixed TextHelper#pluralize to handle 1 as a string #5905 [rails@bencurtis.com] 2 4 3 5 * Improved resolution of DateHelper#distance_of_time_in_words for better precision #5994 [Bob Silva] trunk/actionpack/lib/action_view/helpers/text_helper.rb
r4916 r4993 61 61 # Attempts to pluralize the +singular+ word unless +count+ is 1. See source for pluralization rules. 62 62 def pluralize(count, singular, plural = nil) 63 "#{count} " + if count == 1 63 "#{count} " + if count == 1 || count == '1' 64 64 singular 65 65 elsif plural trunk/actionpack/test/template/text_helper_test.rb
r4916 r4993 113 113 assert_equal("1 count", pluralize(1, "count")) 114 114 assert_equal("2 counts", pluralize(2, "count")) 115 assert_equal("1 count", pluralize('1', "count")) 116 assert_equal("2 counts", pluralize('2', "count")) 117 assert_equal("1,066 counts", pluralize('1,066', "count")) 118 assert_equal("1.25 counts", pluralize('1.25', "count")) 115 119 end 116 120