diff options
Diffstat (limited to 'activesupport/lib/active_support/inflector.rb')
-rw-r--r-- | activesupport/lib/active_support/inflector.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/activesupport/lib/active_support/inflector.rb b/activesupport/lib/active_support/inflector.rb index ee5d5753c9..8fca3e36da 100644 --- a/activesupport/lib/active_support/inflector.rb +++ b/activesupport/lib/active_support/inflector.rb @@ -218,13 +218,16 @@ module Inflector pluralize(underscore(class_name)) end - # Create a class name from a table name like Rails does for table names to models. + # Create a class name from a plural table name like Rails does for table names to models. # Note that this returns a string and not a Class. (To convert to an actual class # follow classify with constantize.) # # Examples # "egg_and_hams".classify #=> "EggAndHam" - # "post".classify #=> "Post" + # "posts".classify #=> "Post" + # + # Singular names are not handled correctly + # "business".classify #=> "Busines" def classify(table_name) # strip out any leading schema name camelize(singularize(table_name.to_s.sub(/.*\./, ''))) |