diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2006-11-05 05:04:21 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2006-11-05 05:04:21 +0000 |
commit | 4d5b913fcf73b352f5a426c862dbeb483d67a9a3 (patch) | |
tree | 4bd368d610916f32e470a9d320500a24812e9725 | |
parent | 080ec9803e340e36d2635a272ee4cf9a243945fe (diff) | |
download | rails-4d5b913fcf73b352f5a426c862dbeb483d67a9a3.tar.gz rails-4d5b913fcf73b352f5a426c862dbeb483d67a9a3.tar.bz2 rails-4d5b913fcf73b352f5a426c862dbeb483d67a9a3.zip |
pluralize helper interprets nil as zero. Closes #6474.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5431 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/text_helper.rb | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index ab5cdd3b3b..598d24952f 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* pluralize helper interprets nil as zero. #6474 [pope] + * Fix invalid test fixture exposed by stricter Ruby 1.8.5 multipart parsing. #6524 [Bob Silva] * Set ActionView::Base.default_form_builder once rather than passing the :builder option to every form or overriding the form helper methods. [Jeremy Kemper] diff --git a/actionpack/lib/action_view/helpers/text_helper.rb b/actionpack/lib/action_view/helpers/text_helper.rb index f1d67c53bb..c5b757d6e1 100644 --- a/actionpack/lib/action_view/helpers/text_helper.rb +++ b/actionpack/lib/action_view/helpers/text_helper.rb @@ -85,7 +85,7 @@ module ActionView # pluralize(2, 'person') => 2 people # pluralize(3, 'person', 'users') => 3 users def pluralize(count, singular, plural = nil) - "#{count} " + if count == 1 || count == '1' + "#{count || 0} " + if count == 1 || count == '1' singular elsif plural plural |