Browse files

Merge pull request #9645 from senny/9643_habtm_wrong_table_name

document habtm join-table name with custom prefix [ci skip]
  • Loading branch information...
2 parents dff4d4a + 12d57ca commit 5522fd9bd8a1efd79cb2f48c712fa95092c15907 @carlosantoniodasilva carlosantoniodasilva committed Mar 10, 2013
Showing with 2 additions and 0 deletions.
  1. +2 −0 activerecord/lib/active_record/associations.rb
@@ -1407,6 +1407,8 @@ def belongs_to(name, scope = nil, options = {})
# to generate a join table name of "papers_paper_boxes" because of the length of the name "paper_boxes",
# but it in fact generates a join table name of "paper_boxes_papers". Be aware of this caveat, and use the
# custom <tt>:join_table</tt> option if you need to.
+ # If your tables share a common prefix, it will only appear once at the beginning. For example,
+ # the tables "catalog_categories" and "catalog_products" generate a join table name of "catalog_categories_products".
# The join table should not have a primary key or a model associated with it. You must manually generate the
# join table with a migration such as this:

0 comments on commit 5522fd9

Please sign in to comment.