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

Changeset 8282

Show
Ignore:
Timestamp:
12/05/07 14:28:05 (9 months ago)
Author:
marcel
Message:

Give examples for what tables should be called for models inside a module namespace. Closes #10288 [scott_willson]

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/activerecord/CHANGELOG

    r8281 r8282  
    11*SVN* 
     2 
     3* Give examples for what tables should be called for models inside a module namespace. Closes #10288 [scott_willson] 
    24 
    35* Document the :message option for validates_associated. Closes #10357 [dylans] 
  • trunk/activerecord/lib/active_record/base.rb

    r8280 r8282  
    722722      # Guesses the table name (in forced lower-case) based on the name of the class in the inheritance hierarchy descending 
    723723      # directly from ActiveRecord. So if the hierarchy looks like: Reply < Message < ActiveRecord, then Message is used 
    724       # to guess the table name from even when called on Reply. The rules used to do the guess are handled by the Inflector class 
     724      # to guess the table name even when called on Reply. The rules used to do the guess are handled by the Inflector class 
    725725      # in Active Support, which knows almost all common English inflections. You can add new inflections in config/initializers/inflections.rb. 
    726726      # 
    727727      # Nested classes are given table names prefixed by the singular form of 
    728       # the parent's table name. Example: 
     728      # the parent's table name. Enclosing modules are not considered. Examples: 
     729      # 
     730      #   class Invoice < ActiveRecord::Base; end; 
    729731      #   file                  class               table_name 
    730732      #   invoice.rb            Invoice             invoices 
    731       #   invoice/lineitem.rb   Invoice::Lineitem   invoice_lineitems 
     733      # 
     734      #   class Invoice < ActiveRecord::Base; class Lineitem < ActiveRecord::Base; end; end; 
     735      #   file                  class               table_name 
     736      #   invoice.rb            Invoice::Lineitem   invoice_lineitems 
     737      # 
     738      #   module Invoice; class Lineitem < ActiveRecord::Base; end; end; 
     739      #   file                  class               table_name 
     740      #   invoice/lineitem.rb   Invoice::Lineitem   lineitems 
    732741      # 
    733742      # Additionally, the class-level table_name_prefix is prepended and the