1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Merge pull request #34278 from GeniusStorm/remove_dependent_destroy_from_belongs_to_doc

Fix #33914 : Remove dependent: :destroy option from the belong_to example since there is a warning associated with the usage of dependent: :destroy along with belongs_to
This commit is contained in:
Gannon McGibbon 2018-10-22 14:57:23 -04:00 committed by GitHub
commit 9e04563ae0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -868,7 +868,7 @@ While Rails uses intelligent defaults that will work well in most situations, th
```ruby
class Book < ApplicationRecord
belongs_to :author, dependent: :destroy,
belongs_to :author, touch: :books_updated_at,
counter_cache: true
end
```
@ -1048,8 +1048,7 @@ There may be times when you wish to customize the query used by `belongs_to`. Su
```ruby
class Book < ApplicationRecord
belongs_to :author, -> { where active: true },
dependent: :destroy
belongs_to :author, -> { where active: true }
end
```