Ruby on Rails | Screencasts | Download | Documentation | Weblog | Community | Source

Changeset 8599

Show
Ignore:
Timestamp:
01/08/08 21:20:04 (9 months ago)
Author:
nzkoz
Message:

Merge classify documentation. Closes #10615 [kris_chambers]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/2-0-stable/activesupport/lib/active_support/core_ext/string/inflections.rb

    r5924 r8599  
    105105        end 
    106106 
    107         # Create a class name from a table name like Rails does for table names to models. 
     107        # Create a class name from a plural table name like Rails does for table names to models. 
    108108        # Note that this returns a string and not a Class. (To convert to an actual class 
    109109        # follow classify with constantize.) 
     
    111111        # Examples 
    112112        #   "egg_and_hams".classify #=> "EggAndHam" 
    113         #   "post".classify #=> "Post" 
     113        #   "posts".classify #=> "Post" 
     114        # 
     115        # Singular names are not handled correctly 
     116        #   "business".classify #=> "Busines" 
    114117        def classify 
    115118          Inflector.classify(self) 
  • branches/2-0-stable/activesupport/lib/active_support/inflector.rb

    r8585 r8599  
    219219  end 
    220220 
    221   # Create a class name from a table name like Rails does for table names to models. 
     221  # Create a class name from a plural table name like Rails does for table names to models. 
    222222  # Note that this returns a string and not a Class. (To convert to an actual class 
    223223  # follow classify with constantize.) 
     
    225225  # Examples 
    226226  #   "egg_and_hams".classify #=> "EggAndHam" 
    227   #   "post".classify #=> "Post" 
     227  #   "posts".classify #=> "Post" 
     228  # 
     229  # Singular names are not handled correctly 
     230  #   "business".classify #=> "Busines" 
    228231  def classify(table_name) 
    229232    # strip out any leading schema name