aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-03-06 13:43:04 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-03-06 13:43:04 +0000
commit6cae2b743913bad7fc530c01f80cc6fe7ef9309d (patch)
tree1adb1e63a60cf891dc22af15d216dbd1193e6403
parent7267db58906434da54e0f50122b5e8b704b1c953 (diff)
downloadrails-6cae2b743913bad7fc530c01f80cc6fe7ef9309d.tar.gz
rails-6cae2b743913bad7fc530c01f80cc6fe7ef9309d.tar.bz2
rails-6cae2b743913bad7fc530c01f80cc6fe7ef9309d.zip
Added inflection rules for "sh" words, like "wish" and "fish" #755 [phillip@pjbsoftware.com]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@844 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--activesupport/CHANGELOG2
-rw-r--r--activesupport/lib/active_support/inflector.rb4
-rw-r--r--activesupport/test/inflector_test.rb4
3 files changed, 8 insertions, 2 deletions
diff --git a/activesupport/CHANGELOG b/activesupport/CHANGELOG
index 14876558c6..551a100663 100644
--- a/activesupport/CHANGELOG
+++ b/activesupport/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Added inflection rules for "sh" words, like "wish" and "fish" #755 [phillip@pjbsoftware.com]
+
* Fixed an exception when using Ajax based requests from Safari because Safari appends a \000 to the post body. Symbols can't have \000 in them so indifferent access would throw an exception in the constructor. Indifferent hashes now use strings internally instead. #746 [Tobias Luetke]
* Added String#to_time and String#to_date for wrapping ParseDate
diff --git a/activesupport/lib/active_support/inflector.rb b/activesupport/lib/active_support/inflector.rb
index e09208dd4f..557ffca06e 100644
--- a/activesupport/lib/active_support/inflector.rb
+++ b/activesupport/lib/active_support/inflector.rb
@@ -57,6 +57,7 @@ module Inflector
private
def plural_rules #:doc:
[
+ [/fish$/, 'fish'], # fish
[/(x|ch|ss|sh)$/, '\1es'], # search, switch, fix, box, process, address
[/series$/, '\1series'],
[/([^aeiouy]|qu)ies$/, '\1y'],
@@ -74,7 +75,8 @@ module Inflector
def singular_rules #:doc:
[
- [/(x|ch|ss)es$/, '\1'],
+ [/fish$/, 'fish'],
+ [/(x|ch|ss|sh)es$/, '\1'],
[/movies$/, 'movie'],
[/series$/, 'series'],
[/([^aeiouy]|qu)ies$/, '\1y'],
diff --git a/activesupport/test/inflector_test.rb b/activesupport/test/inflector_test.rb
index 6723313046..14a532a9a2 100644
--- a/activesupport/test/inflector_test.rb
+++ b/activesupport/test/inflector_test.rb
@@ -17,7 +17,9 @@ class InflectorTest < Test::Unit::TestCase
"process" => "processes",
"address" => "addresses",
"case" => "cases",
- "stack" => "stacks",
+ "stack" => "stacks",
+ "wish" => "wishes",
+ "fish" => "fish",
"category" => "categories",
"query" => "queries",