From 8255f28d87f1e6f3973c89d9754303f4acd329f1 Mon Sep 17 00:00:00 2001 From: Oleg Valter Date: Sun, 1 Dec 2024 19:41:15 +0300 Subject: [PATCH] when saving post drafts, do not insert nil records in Redis (tags list) --- app/controllers/posts_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/posts_controller.rb b/app/controllers/posts_controller.rb index c5fa0e04f..341db5187 100644 --- a/app/controllers/posts_controller.rb +++ b/app/controllers/posts_controller.rb @@ -602,7 +602,9 @@ def save_draft key_name = [:body, :saved_at].include?(key) ? base_key : "#{base_key}.#{key}" if key == :tags - RequestContext.redis.sadd(key_name, params[key]) + if params[key].present? + RequestContext.redis.sadd(key_name, params[key]) + end else RequestContext.redis.set(key_name, params[key]) end