Sign in through GitHub

Please read for an updated status on RailsCasts:

Learn more or hide this

Toby Ovod-Everett's Profile

GitHub User: tovodeverett


Comments by Toby Ovod-Everett


My understanding is that calling singularize before classify is redundant and can lead to problems with singular forms that end with "s". See and To be safe, classify should only be called on a plural form. The camelize method can be called on either and will return a result with the same grammatical number (i.e. singular or plural). Of note, the source for classify (at least in 3.2.8) is:

camelize(singularize(table_name.to_s.sub(/.*\./, '')))

Repeated calls to singularize are not necessarily safe:

"businesses".singularize # => "business"
"business".singularize   # => "busines"
"busines".singularize    # => "busine"
"busine".singularize     # => "busine"