Skip to content

Commit

Permalink
Give examples for what tables should be called for models inside a mo…
Browse files Browse the repository at this point in the history
…dule namespace. Closes #10288 [scott_willson]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8282 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information
Marcel Molina committed Dec 5, 2007
1 parent 7f671f4 commit d64832c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
2 changes: 2 additions & 0 deletions activerecord/CHANGELOG
@@ -1,5 +1,7 @@
*SVN* *SVN*


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

* Document the :message option for validates_associated. Closes #10357 [dylans] * Document the :message option for validates_associated. Closes #10357 [dylans]


* Document automatically generated predicate methods for attributes. Closes #10373 [chuyeow] * Document automatically generated predicate methods for attributes. Closes #10373 [chuyeow]
Expand Down
15 changes: 12 additions & 3 deletions activerecord/lib/active_record/base.rb
Expand Up @@ -721,14 +721,23 @@ def serialized_attributes


# Guesses the table name (in forced lower-case) based on the name of the class in the inheritance hierarchy descending # Guesses the table name (in forced lower-case) based on the name of the class in the inheritance hierarchy descending
# directly from ActiveRecord. So if the hierarchy looks like: Reply < Message < ActiveRecord, then Message is used # directly from ActiveRecord. So if the hierarchy looks like: Reply < Message < ActiveRecord, then Message is used
# to guess the table name from even when called on Reply. The rules used to do the guess are handled by the Inflector class # to guess the table name even when called on Reply. The rules used to do the guess are handled by the Inflector class
# in Active Support, which knows almost all common English inflections. You can add new inflections in config/initializers/inflections.rb. # in Active Support, which knows almost all common English inflections. You can add new inflections in config/initializers/inflections.rb.
# #
# Nested classes are given table names prefixed by the singular form of # Nested classes are given table names prefixed by the singular form of
# the parent's table name. Example: # the parent's table name. Enclosing modules are not considered. Examples:
#
# class Invoice < ActiveRecord::Base; end;
# file class table_name # file class table_name
# invoice.rb Invoice invoices # invoice.rb Invoice invoices
# invoice/lineitem.rb Invoice::Lineitem invoice_lineitems #
# class Invoice < ActiveRecord::Base; class Lineitem < ActiveRecord::Base; end; end;
# file class table_name
# invoice.rb Invoice::Lineitem invoice_lineitems
#
# module Invoice; class Lineitem < ActiveRecord::Base; end; end;
# file class table_name
# invoice/lineitem.rb Invoice::Lineitem lineitems
# #
# Additionally, the class-level table_name_prefix is prepended and the # Additionally, the class-level table_name_prefix is prepended and the
# table_name_suffix is appended. So if you have "myapp_" as a prefix, # table_name_suffix is appended. So if you have "myapp_" as a prefix,
Expand Down

0 comments on commit d64832c

Please sign in to comment.