aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
diff options
context:
space:
mode:
authorKuldeep Aggarwal <kd.engineer@yahoo.co.in>2014-04-19 01:31:07 +0530
committerKuldeep Aggarwal <kd.engineer@yahoo.co.in>2014-04-19 01:31:07 +0530
commit459f7bf38aa196cf4d2d970173b02d88e4a4e75c (patch)
tree1253ffbbacd1ac63b2d65b95f69113159db88e1c /activesupport/lib/active_support
parent5f72fc6af8ad19df2b4e4f442b9ab17dd6846f46 (diff)
downloadrails-459f7bf38aa196cf4d2d970173b02d88e4a4e75c.tar.gz
rails-459f7bf38aa196cf4d2d970173b02d88e4a4e75c.tar.bz2
rails-459f7bf38aa196cf4d2d970173b02d88e4a4e75c.zip
Fix inconsistent behavior from String#pluralize
Before: When calling String#pluralize with count=1 then it returned same string, but with count other than 1, returned new string. After: String#pluralize always return a new string. => Prevent mutation of a string inadvertently.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r--activesupport/lib/active_support/core_ext/string/inflections.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activesupport/lib/active_support/core_ext/string/inflections.rb b/activesupport/lib/active_support/core_ext/string/inflections.rb
index 18273573e0..a943752f17 100644
--- a/activesupport/lib/active_support/core_ext/string/inflections.rb
+++ b/activesupport/lib/active_support/core_ext/string/inflections.rb
@@ -31,7 +31,7 @@ class String
def pluralize(count = nil, locale = :en)
locale = count if count.is_a?(Symbol)
if count == 1
- self
+ self.dup
else
ActiveSupport::Inflector.pluralize(self, locale)
end