public
Fork of rails/rails
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/josh/rails.git
[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/branches/1-2-pre-release@5961 
5ecf4fe2-1ee6-0310-87b1-e25e094e27de
technoweenie (author)
Mon Jan 15 22:31:53 -0800 2007
commit  cc99f3fc188405a51d4e9d93002b5dc2ee473a3d
tree    c7d0ef452421ba8af87edd1f8dfa57a064be4472
parent  d25ae9b6e1a20f4f2c10b8a70478423b3e7980a6
...
1
2
 
 
3
4
5
...
1
2
3
4
5
6
7
0
@@ -1,5 +1,7 @@
0
 *SVN*
0
 
0
+* [DOC] clear up some ambiguity with the way has_and_belongs_to_many creates the default join table name. #7072 [jeremymcanally]
0
+
0
 * change_column accepts :default => nil. Skip column options for primary keys. #6956, #7048 [dcmanges, Jeremy Kemper]
0
 
0
 * MySQL, PostgreSQL: change_column_default quotes the default value and doesn't lose column type information. #3987, #6664 [Jonathan Viney, manfred, altano@bigfoot.com]
...
745
746
747
748
 
 
 
 
 
 
 
749
750
751
...
745
746
747
 
748
749
750
751
752
753
754
755
756
757
0
@@ -745,7 +745,13 @@ module ActiveRecord
0
 
0
       # Associates two classes via an intermediate join table. Unless the join table is explicitly specified as
0
       # an option, it is guessed using the lexical order of the class names. So a join between Developer and Project
0
- # will give the default join table name of "developers_projects" because "D" outranks "P".
0
+ # will give the default join table name of "developers_projects" because "D" outranks "P". Note that this precedence
0
+ # is calculated using the <tt><</tt> operator for <tt>String</tt>. This means that if the strings are of different lengths,
0
+ # and the strings are equal when compared up to the shortest length, then the longer string is considered of higher
0
+ # lexical precedence than the shorter one. For example, one would expect the tables <tt>paper_boxes</tt> and <tt>papers</tt>
0
+ # to generate a join table name of <tt>papers_paper_boxes</tt> because of the length of the name <tt>paper_boxes</tt>,
0
+ # but it in fact generates a join table name of <tt>paper_boxes_papers</tt>. Be aware of this caveat, and use the
0
+ # custom <tt>join_table</tt> option if you need to.
0
       #
0
       # Deprecated: Any additional fields added to the join table will be placed as attributes when pulling records out through
0
       # has_and_belongs_to_many associations. Records returned from join tables with additional attributes will be marked as

Comments

    No one has commented yet.