diff options
author | Rick Olson <technoweenie@gmail.com> | 2007-01-16 06:30:02 +0000 |
---|---|---|
committer | Rick Olson <technoweenie@gmail.com> | 2007-01-16 06:30:02 +0000 |
commit | 56c55354661fcadecb1927fb62fb9038d16e9be1 (patch) | |
tree | 484906d9527735f1a357e4941fc751d1228fa670 /activerecord/lib/active_record | |
parent | 71a4f7161fb02cd5b2cefb374224be94b185306a (diff) | |
download | rails-56c55354661fcadecb1927fb62fb9038d16e9be1.tar.gz rails-56c55354661fcadecb1927fb62fb9038d16e9be1.tar.bz2 rails-56c55354661fcadecb1927fb62fb9038d16e9be1.zip |
[DOC] clear up some ambiguity with the way has_and_belongs_to_many creates the default join table name. #7072 [jeremymcanally]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5960 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record')
-rwxr-xr-x | activerecord/lib/active_record/associations.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb index f1c274af42..4f251077ed 100755 --- a/activerecord/lib/active_record/associations.rb +++ b/activerecord/lib/active_record/associations.rb @@ -809,7 +809,13 @@ module ActiveRecord # Associates two classes via an intermediate join table. Unless the join table is explicitly specified as # an option, it is guessed using the lexical order of the class names. So a join between Developer and Project - # will give the default join table name of "developers_projects" because "D" outranks "P". + # will give the default join table name of "developers_projects" because "D" outranks "P". Note that this precedence + # is calculated using the <tt><</tt> operator for <tt>String</tt>. This means that if the strings are of different lengths, + # and the strings are equal when compared up to the shortest length, then the longer string is considered of higher + # lexical precedence than the shorter one. For example, one would expect the tables <tt>paper_boxes</tt> and <tt>papers</tt> + # to generate a join table name of <tt>papers_paper_boxes</tt> because of the length of the name <tt>paper_boxes</tt>, + # but it in fact generates a join table name of <tt>paper_boxes_papers</tt>. Be aware of this caveat, and use the + # custom <tt>join_table</tt> option if you need to. # # Deprecated: Any additional fields added to the join table will be placed as attributes when pulling records out through # has_and_belongs_to_many associations. Records returned from join tables with additional attributes will be marked as |