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:
commit
9e04563ae0
1 changed files with 2 additions and 3 deletions
|
@ -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
|
||||
```
|
||||
|
||||
|
|
Loading…
Reference in a new issue