aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--activesupport/CHANGELOG2
-rw-r--r--activesupport/lib/active_support/inflector.rb20
-rw-r--r--activesupport/test/inflector_test.rb1
3 files changed, 13 insertions, 10 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index aa9f5b887d..e425e4f3c5 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,6 +1,6 @@
*SVN*
-* Added new rules to the Inflector to deal with more unusual plurals mouse/louse => mice/lice, information => information, ox => oxen #1571 [foamdino@gmail.com]
+* Added new rules to the Inflector to deal with more unusual plurals mouse/louse => mice/lice, information => information, ox => oxen, photo => photos #1571, #1583 [foamdino@gmail.com]
* Fixed memory leak with Object#remove_subclasses_of, which inflicted a Rails application running in development mode with a ~20KB leak per request #1289 [c.r.mcgrath@gmail.com]
diff --git a/activesupport/lib/active_support/inflector.rb b/activesupport/lib/active_support/inflector.rb
index dc0d57b901..0e8fad221c 100644
--- a/activesupport/lib/active_support/inflector.rb
+++ b/activesupport/lib/active_support/inflector.rb
@@ -58,9 +58,9 @@ module Inflector
def plural_rules #:doc:
[
[/(fish)$/i, '\1\2'], # fish
- [/(information)$/i, '\1'], # information (plural noun)
- [/^(ox)$/i, '\1\2en'], # ox
- [/([m|l])ouse/i, '\1ice'], # mouse, louse
+ [/(information)$/i, '\1'], # information (plural noun)
+ [/^(ox)$/i, '\1\2en'], # ox
+ [/([m|l])ouse/i, '\1ice'], # mouse, louse
[/(x|ch|ss|sh)$/i, '\1es'], # search, switch, fix, box, process, address
[/(series)$/i, '\1\2'],
[/([^aeiouy]|qu)ies$/i, '\1y'],
@@ -71,8 +71,9 @@ module Inflector
[/(p)erson$/i, '\1\2eople'], # person, salesperson
[/(m)an$/i, '\1\2en'], # man, woman, spokesman
[/(c)hild$/i, '\1\2hildren'], # child
- [/(o)$/i, '\1\2es'], # buffalo, tomato
- [/(bu)s$/i, '\1\2ses'], # bus
+ [/(photo)$/i, '\1s'],
+ [/(o)$/i, '\1\2es'], # buffalo, tomato
+ [/(bu)s$/i, '\1\2ses'], # bus
[/s$/i, 's'], # no change (compatibility)
[/$/, 's']
]
@@ -81,10 +82,11 @@ module Inflector
def singular_rules #:doc:
[
[/(f)ish$/i, '\1\2ish'],
- [/^(ox)en/i, '\1'],
- [/(o)es/i, '\1'],
- [/(bus)es$/i, '\1'],
- [/([m|l])ice/i, '\1ouse'],
+ [/^(ox)en/i, '\1'],
+ [/(photo)s$/i, '\1'],
+ [/(o)es/i, '\1'],
+ [/(bus)es$/i, '\1'],
+ [/([m|l])ice/i, '\1ouse'],
[/(x|ch|ss|sh)es$/i, '\1'],
[/(m)ovies$/i, '\1\2ovie'],
[/(s)eries$/i, '\1\2eries'],
diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb
index b95d543304..37687636ad 100644
--- a/activesupport/test/inflector_test.rb
+++ b/activesupport/test/inflector_test.rb
@@ -63,6 +63,7 @@ class InflectorTest < Test::Unit::TestCase
"perspective" => "perspectives",
"ox" => "oxen",
+ "photo" => "photos",
"buffalo" => "buffaloes",
"tomato" => "tomatoes",
"dwarf" => "dwarves",