Skip to content
Browse files

document habtm join-table name with custom prefix [ci skip].

Closes #9643.

The logic was introduced with 4649294
  • Loading branch information...
1 parent dff4d4a commit 12d57cac5fc27dddc5534088cca6bb3133fab5ea @senny senny committed Mar 10, 2013
Showing with 2 additions and 0 deletions.
  1. +2 −0 activerecord/lib/active_record/associations.rb
View
2 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 12d57ca

Please sign in to comment.
Something went wrong with that request. Please try again.