From 25dda3061e4308a5005d3a2fef373acffc510a66 Mon Sep 17 00:00:00 2001 From: Claire Date: Thu, 26 May 2022 00:20:30 +0200 Subject: [PATCH] Fix unnecessary query on status creation (#17901) --- app/models/status.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/status.rb b/app/models/status.rb index a4e685ce3e..4828d63404 100644 --- a/app/models/status.rb +++ b/app/models/status.rb @@ -454,7 +454,7 @@ class Status < ApplicationRecord end def set_poll_id - update_column(:poll_id, poll.id) unless poll.nil? + update_column(:poll_id, poll.id) if association(:poll).loaded? && poll.present? end def set_visibility