aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorlanzhiheng <lanzhihengrj@gmail.com>2018-07-18 17:35:04 +0800
committerlanzhiheng <lanzhihengrj@gmail.com>2018-07-18 17:58:29 +0800
commitcf05cf7af5de1ef3afcfb5d9b85eb7052bd0c0c2 (patch)
tree6609194860e692e681c6787dc83a71d6386b8858 /guides
parent241bbf268cca61c42b61076deead699010068968 (diff)
downloadrails-cf05cf7af5de1ef3afcfb5d9b85eb7052bd0c0c2.tar.gz
rails-cf05cf7af5de1ef3afcfb5d9b85eb7052bd0c0c2.tar.bz2
rails-cf05cf7af5de1ef3afcfb5d9b85eb7052bd0c0c2.zip
Add situation for belongs to association. [ci skip]
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 e7408b5a7f..67844ae7a4 100644
--- a/guides/source/association_basics.md
+++ b/guides/source/association_basics.md
@@ -96,7 +96,7 @@ end
![belongs_to Association Diagram](images/association_basics/belongs_to.png)
-NOTE: `belongs_to` associations _must_ use the singular term. If you used the pluralized form in the above example for the `author` association in the `Book` model, you would be told that there was an "uninitialized constant Book::Authors". This is because Rails automatically infers the class name from the association name. If the association name is wrongly pluralized, then the inferred class will be wrongly pluralized too.
+NOTE: `belongs_to` associations _must_ use the singular term. If you used the pluralized form in the above example for the `author` association in the `Book` model and tried to create the instance by `Book.create(authors: @author)`, you would be told that there was an "uninitialized constant Book::Authors". This is because Rails automatically infers the class name from the association name. If the association name is wrongly pluralized, then the inferred class will be wrongly pluralized too.
The corresponding migration might look like this: