diff options
author | Xavier Noria <fxn@hashref.com> | 2010-03-02 00:25:25 +0100 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2010-03-02 00:25:25 +0100 |
commit | 88c01b3f10d8bc47359f2f69f69a606ace5fc0f6 (patch) | |
tree | b7f7a72e41f4c319356092334e8150957bf0090d /railties/guides/source/active_support_core_extensions.textile | |
parent | fbce2327a9d327a203bb401708b6e3a4bd023e38 (diff) | |
download | rails-88c01b3f10d8bc47359f2f69f69a606ace5fc0f6.tar.gz rails-88c01b3f10d8bc47359f2f69f69a606ace5fc0f6.tar.bz2 rails-88c01b3f10d8bc47359f2f69f69a606ace5fc0f6.zip |
AS guide: documents String#tableize
Diffstat (limited to 'railties/guides/source/active_support_core_extensions.textile')
-rw-r--r-- | railties/guides/source/active_support_core_extensions.textile | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/railties/guides/source/active_support_core_extensions.textile b/railties/guides/source/active_support_core_extensions.textile index 291dc5e96a..2571c83dd8 100644 --- a/railties/guides/source/active_support_core_extensions.textile +++ b/railties/guides/source/active_support_core_extensions.textile @@ -1450,6 +1450,20 @@ In fact, the result string is wrapped in an instance of +ActiveSupport::Multibyt NOTE: Defined in +active_support/core_ext/string/inflections.rb+. +h5. +tableize+ + +The method +tableize+ is +underscore+ followed by +pluralize+. + +<ruby> +"Person".tableize # => "people" +"Invoice".tableize # => "invoices" +"InvoiceLine".tableize # => "invoice_lines" +</ruby> + +As a rule of thumb, +tableize+ returns the table name that corresponds to a given model for simple cases. The actual implementation in Active Record is not straight +tableize+ indeed, because it also demodulizes de class name and checks a few options that may affect the returned string. + +NOTE: Defined in +active_support/core_ext/string/inflections.rb+. + h3. Extensions to +Numeric+ h4. Bytes |