aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/association_basics.md
diff options
context:
space:
mode:
authorRafael França <rafaelmfranca@gmail.com>2018-07-18 17:07:39 -0400
committerGitHub <noreply@github.com>2018-07-18 17:07:39 -0400
commit5e55c80529071ae474eaeaaa03948294fe6ae637 (patch)
tree94c2a72f456fa94c861d29bb064455a1809366ab /guides/source/association_basics.md
parent371e3752948a324da70dc8fc8b0a2f2c66113112 (diff)
parentcf05cf7af5de1ef3afcfb5d9b85eb7052bd0c0c2 (diff)
downloadrails-5e55c80529071ae474eaeaaa03948294fe6ae637.tar.gz
rails-5e55c80529071ae474eaeaaa03948294fe6ae637.tar.bz2
rails-5e55c80529071ae474eaeaaa03948294fe6ae637.zip
Merge pull request #33384 from lanzhiheng/add-situation-for-belongs-to-associations-note
[ci skip] Add situation for belongs to association.
Diffstat (limited to 'guides/source/association_basics.md')
-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: