aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
authorOscar Del Ben <info@oscardelben.com>2012-05-25 08:59:00 -0700
committerOscar Del Ben <info@oscardelben.com>2012-05-25 09:15:47 -0700
commit26149260bfe5aaee162586e6d1fa54365f8a773e (patch)
tree1c1283dc3420bc61a525f3669d0503a9ed9c9de4 /guides/source
parent3e7d43b43c71a4b4bfc53a51f2383a1d5a75e71f (diff)
downloadrails-26149260bfe5aaee162586e6d1fa54365f8a773e.tar.gz
rails-26149260bfe5aaee162586e6d1fa54365f8a773e.tar.bz2
rails-26149260bfe5aaee162586e6d1fa54365f8a773e.zip
[Guides] Add inflector example
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/initialization.textile4
1 files changed, 4 insertions, 0 deletions
diff --git a/guides/source/initialization.textile b/guides/source/initialization.textile
index fe777d063b..89bb0bba84 100644
--- a/guides/source/initialization.textile
+++ b/guides/source/initialization.textile
@@ -752,6 +752,10 @@ h4. +active_support/inflections+
This file references the +ActiveSupport::Inflector+ constant which isn't loaded by this point. But there were autoloads set up in +activesupport/lib/active_support.rb+ which will load the file which loads this constant and so then it will be defined. Then this file defines pluralization and singularization rules for words in Rails. This is how Rails knows how to pluralize "tomato" to "tomatoes".
+<ruby>
+inflect.irregular('zombie', 'zombies')
+</ruby>
+
h4. +activesupport/lib/active_support/inflector/transliterate.rb+
In this file is where the "+transliterate+":http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-transliterate and +parameterize+:http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-parameterize methods are defined. The documentation for both of these methods is very much worth reading.