diff options
Diffstat (limited to 'guides/source')
-rw-r--r-- | guides/source/association_basics.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md index adf430aef4..c0e584a1c7 100644 --- a/guides/source/association_basics.md +++ b/guides/source/association_basics.md @@ -1736,15 +1736,15 @@ If you want to make sure that, upon insertion, all of the records in the persisted association are distinct (so that you can be sure that when you inspect the association that you will never find duplicate records), you should add a unique index on the table itself. For example, if you have a table named -``person_posts`` and you want to make sure all the posts are unique, you could +`person_posts` and you want to make sure all the posts are unique, you could add the following in a migration: ```ruby -add_index :person_posts, :post, :unique => true +add_index :person_posts, :post, unique: true ``` -Note that checking for uniqueness using something like ``include?`` is subject -to race conditions. Do not attempt to use ``include?`` to enforce distinctness +Note that checking for uniqueness using something like `include?` is subject +to race conditions. Do not attempt to use `include?` to enforce distinctness in an association. For instance, using the post example from above, the following code would be racy because multiple users could be attempting this at the same time: |