diff options
author | Juanjo Bazán <jjbazan@gmail.com> | 2013-01-01 12:50:00 +0100 |
---|---|---|
committer | Juanjo Bazán <jjbazan@gmail.com> | 2013-01-01 12:50:00 +0100 |
commit | ef4ac7a48979f6232591db88599d5ff8ae95b20b (patch) | |
tree | b30f81bb90634ab20ac0eac7dfb916a1622d2ccf /activesupport | |
parent | 8d945f4f97748bfc5083fe1d0020368598a79e47 (diff) | |
download | rails-ef4ac7a48979f6232591db88599d5ff8ae95b20b.tar.gz rails-ef4ac7a48979f6232591db88599d5ff8ae95b20b.tar.bz2 rails-ef4ac7a48979f6232591db88599d5ff8ae95b20b.zip |
Inflector irregular singularize rules
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/lib/active_support/inflector/inflections.rb | 3 | ||||
-rw-r--r-- | activesupport/test/inflector_test_cases.rb | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/inflector/inflections.rb b/activesupport/lib/active_support/inflector/inflections.rb index 9cf4b2b2ba..e80efffe82 100644 --- a/activesupport/lib/active_support/inflector/inflections.rb +++ b/activesupport/lib/active_support/inflector/inflections.rb @@ -132,6 +132,7 @@ module ActiveSupport plural(Regexp.new("(#{singular[0,1]})#{singular[1..-1]}$", "i"), '\1' + plural[1..-1]) plural(Regexp.new("(#{plural[0,1]})#{plural[1..-1]}$", "i"), '\1' + plural[1..-1]) singular(Regexp.new("(#{plural[0,1]})#{plural[1..-1]}$", "i"), '\1' + singular[1..-1]) + singular(Regexp.new("(#{singular[0,1]})#{singular[1..-1]}$", "i"), '\1' + singular[1..-1]) else plural(Regexp.new("#{singular[0,1].upcase}(?i)#{singular[1..-1]}$"), plural[0,1].upcase + plural[1..-1]) plural(Regexp.new("#{singular[0,1].downcase}(?i)#{singular[1..-1]}$"), plural[0,1].downcase + plural[1..-1]) @@ -139,6 +140,8 @@ module ActiveSupport plural(Regexp.new("#{plural[0,1].downcase}(?i)#{plural[1..-1]}$"), plural[0,1].downcase + plural[1..-1]) singular(Regexp.new("#{plural[0,1].upcase}(?i)#{plural[1..-1]}$"), singular[0,1].upcase + singular[1..-1]) singular(Regexp.new("#{plural[0,1].downcase}(?i)#{plural[1..-1]}$"), singular[0,1].downcase + singular[1..-1]) + singular(Regexp.new("#{singular[0,1].upcase}(?i)#{singular[1..-1]}$"), singular[0,1].upcase + singular[1..-1]) + singular(Regexp.new("#{singular[0,1].downcase}(?i)#{singular[1..-1]}$"), singular[0,1].downcase + singular[1..-1]) end end diff --git a/activesupport/test/inflector_test_cases.rb b/activesupport/test/inflector_test_cases.rb index ca4efd2e59..7704300938 100644 --- a/activesupport/test/inflector_test_cases.rb +++ b/activesupport/test/inflector_test_cases.rb @@ -310,5 +310,6 @@ module InflectorTestCases 'move' => 'moves', 'cow' => 'kine', 'zombie' => 'zombies', + 'genus' => 'genera' } end |