aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorK. Rodman Mannix <kevin@getfreebird.com>2018-07-22 09:04:03 -0400
committerK. Rodman Mannix <kevin@getfreebird.com>2018-07-22 10:37:26 -0400
commit063003f3f7ec10c018b5999eb877f61fcc8831be (patch)
tree50ce2154f78d7bef26c9219fa18f523a2d02b710 /guides
parent20543c049625784a91944efdebc1d0c397406f21 (diff)
downloadrails-063003f3f7ec10c018b5999eb877f61fcc8831be.tar.gz
rails-063003f3f7ec10c018b5999eb877f61fcc8831be.tar.bz2
rails-063003f3f7ec10c018b5999eb877f61fcc8831be.zip
[ci skip] fix typo in Associations guide
Diffstat (limited to 'guides')
-rw-r--r--guides/source/association_basics.md2
1 files changed, 1 insertions, 1 deletions
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md
index 67844ae7a4..808aa9d691 100644
--- a/guides/source/association_basics.md
+++ b/guides/source/association_basics.md
@@ -600,7 +600,7 @@ NOTE: If you wish to [enforce referential integrity at the database level](/acti
#### Creating Join Tables for `has_and_belongs_to_many` Associations
-If you create a `has_and_belongs_to_many` association, you need to explicitly create the joining table. Unless the name of the join table is explicitly specified by using the `:join_table` option, Active Record creates the name by using the lexical book of the class names. So a join between author and book models will give the default join table name of "authors_books" because "a" outranks "b" in lexical ordering.
+If you create a `has_and_belongs_to_many` association, you need to explicitly create the joining table. Unless the name of the join table is explicitly specified by using the `:join_table` option, Active Record creates the name by using the lexical order of the class names. So a join between author and book models will give the default join table name of "authors_books" because "a" outranks "b" in lexical ordering.
WARNING: The precedence between model names is calculated using the `<=>` operator for `String`. 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 "paper_boxes" and "papers" 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" (because the underscore '\_' is lexicographically _less_ than 's' in common encodings).