From b2e74b36bf3b858e3d08fff3ef66351c1e259caa Mon Sep 17 00:00:00 2001 From: Raghu Kamat Date: Sun, 21 Oct 2018 22:59:48 -0400 Subject: [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. --- guides/source/association_basics.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'guides/source') 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 ``` -- cgit v1.2.3