提交 1010f938 编写于 作者: M Mikhail Dieterle

fix quotes and ruby old hashes

上级 d4794fd9
......@@ -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:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册