aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorRaghu Kamat <rkamat@teladoc.com>2018-10-21 22:59:48 -0400
committerRaghu Kamat <rkamat@teladoc.com>2018-10-22 14:39:05 -0400
commitb2e74b36bf3b858e3d08fff3ef66351c1e259caa (patch)
tree7a50196816f2598bab673f98c9acb7658d8d3032 /guides
parent64385bdf30b3bd7a44e2f456fca6a33ae2bb451c (diff)
downloadrails-b2e74b36bf3b858e3d08fff3ef66351c1e259caa.tar.gz
rails-b2e74b36bf3b858e3d08fff3ef66351c1e259caa.tar.bz2
rails-b2e74b36bf3b858e3d08fff3ef66351c1e259caa.zip
[ci skip] Fix #33914
This commit removes the dependent: :destroy option from the belong_to example since there is a warning associated with the usage of dependent: :destroy along with belongs_to. Based on the feedback on the issue #33914, I replaced dependent: :destroy with touch: :books_updated_at which will make the example consistent with the example that already exists on that page. * Also Removing the touch option from the belong_to scopes example as the option doesnt have any relation to association scope.
Diffstat (limited to 'guides')
-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
```