Sunday, January 24, 2010

Recipe 10: Smart Pluralization

(This post is one of a series that upadates Chad Fowler's Rails Recipes.)

Rails has a mechanism for tracking the singular and plural forms of nouns. One is likely to want to supplement the rules that it uses. This recipe describes how to do that, but Rails now makes the process even easier. Rather than putting the change in config/environment.rb, there is a separate file for such rules in config/initializers/inflections.rb. That file even has sample code that is more current than what appears in the text.

No comments:

Post a Comment