diff options
author | Jaime Iniesta <jaimeiniesta@gmail.com> | 2010-04-01 17:20:36 +0200 |
---|---|---|
committer | Jaime Iniesta <jaimeiniesta@gmail.com> | 2010-04-01 17:20:36 +0200 |
commit | 78ab9beb499740036f1e570dc03e811ae7cffc0b (patch) | |
tree | 5c1a83f6e1f5c6c5beee202393b29cda4df9a374 /railties/guides/source | |
parent | cd9721791f824f61dfe1650310aec925b3a1f559 (diff) | |
download | rails-78ab9beb499740036f1e570dc03e811ae7cffc0b.tar.gz rails-78ab9beb499740036f1e570dc03e811ae7cffc0b.tar.bz2 rails-78ab9beb499740036f1e570dc03e811ae7cffc0b.zip |
Fix unescaped '<' and badly formed ids on association_basics guide
Diffstat (limited to 'railties/guides/source')
-rw-r--r-- | railties/guides/source/association_basics.textile | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/railties/guides/source/association_basics.textile b/railties/guides/source/association_basics.textile index 757dce1f4e..4e93bb874b 100644 --- a/railties/guides/source/association_basics.textile +++ b/railties/guides/source/association_basics.textile @@ -417,7 +417,7 @@ h5. 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 order of the class names. So a join between customer and order models will give the default join table name of "customers_orders" because "c" outranks "o" 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). +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). Whatever the name, you must manually generate the join table with an appropriate migration. For example, consider these associations: @@ -540,7 +540,7 @@ build_customer create_customer </ruby> -h6. _association_(force_reload = false) +h6. association(force_reload = false) The <tt><em>association</em></tt> method returns the associated object, if any. If no associated object is found, it returns +nil+. @@ -550,7 +550,7 @@ The <tt><em>association</em></tt> method returns the associated object, if any. If the associated object has already been retrieved from the database for this object, the cached version will be returned. To override this behavior (and force a database read), pass +true+ as the +force_reload+ argument. -h6. _association_=(associate) +h6. association=(associate) The <tt><em>association</em>=</tt> method assigns an associated object to this object. Behind the scenes, this means extracting the primary key from the associate object and setting this object's foreign key to the same value. |