aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source
diff options
context:
space:
mode:
authorGannon McGibbon <gannon.mcgibbon@gmail.com>2018-10-22 14:57:23 -0400
committerGitHub <noreply@github.com>2018-10-22 14:57:23 -0400
commit9e04563ae0c488d056861965400874f6102e14f1 (patch)
tree7a50196816f2598bab673f98c9acb7658d8d3032 /guides/source
parent64385bdf30b3bd7a44e2f456fca6a33ae2bb451c (diff)
parentb2e74b36bf3b858e3d08fff3ef66351c1e259caa (diff)
downloadrails-9e04563ae0c488d056861965400874f6102e14f1.tar.gz
rails-9e04563ae0c488d056861965400874f6102e14f1.tar.bz2
rails-9e04563ae0c488d056861965400874f6102e14f1.zip
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
Diffstat (limited to 'guides/source')
-rw-r--r--guides/source/association_basics.md5
1 files changed, 2 insertions, 3 deletions
diff --git a/guides/source/association_basics.md b/guides/source/association_basics.md
index b0a905c754..78a1f47407 100644
--- a/guides/source/association_basics.md
+++ b/guides/source/association_basics.md
@@ -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
```