diff options
author | Robin Dupret <robin.dupret@gmail.com> | 2015-04-12 15:33:33 +0200 |
---|---|---|
committer | Robin Dupret <robin.dupret@gmail.com> | 2015-04-12 15:34:28 +0200 |
commit | 5493e9c7f8d7a29ae013d7e0a619ef111aeb989c (patch) | |
tree | 416833221917a39df9a6605792d06da4ef39c022 /guides/source/association_basics.md | |
parent | 5c0a61881b54499742ea1eba7cce456deba8df42 (diff) | |
download | rails-5493e9c7f8d7a29ae013d7e0a619ef111aeb989c.tar.gz rails-5493e9c7f8d7a29ae013d7e0a619ef111aeb989c.tar.bz2 rails-5493e9c7f8d7a29ae013d7e0a619ef111aeb989c.zip |
Fix a few typos and wrap some lines [ci skip]
Diffstat (limited to 'guides/source/association_basics.md')
-rw-r--r-- | guides/source/association_basics.md | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md index d215d8b30f..8b6d70f1ad 100644 --- a/guides/source/association_basics.md +++ b/guides/source/association_basics.md @@ -916,8 +916,8 @@ TIP: In any case, Rails will not create foreign key columns for you. You need to ##### `:primary_key` -By convention, Rails assumes that the `id` column is used to hold the primary key of it's table. -The `:primary_key` option allows you to specify a different column. +By convention, Rails assumes that the `id` column is used to hold the primary key +of its tables. The `:primary_key` option allows you to specify a different column. For example, given we have a `users` table with `guid` as the primary key. If we want a separate `todos` table to hold the foreign key `user_id` in the `guid` column, then we can use `primary_key` to achieve this like so: @@ -931,7 +931,8 @@ class Todo < ActiveRecord::Base end ``` -When we execute `@user.todos.create` then the `@todo` record will have `user_id` value as the `guid` value of `@user`. +When we execute `@user.todos.create` then the `@todo` record will have its +`user_id` value as the `guid` value of `@user`. ##### `:inverse_of` |