Skip to content

Commit

Permalink
when saving post drafts, do not insert nil records in Redis (tags list)
Browse files Browse the repository at this point in the history
  • Loading branch information
Oaphi committed Dec 1, 2024
1 parent ffa4b0a commit 8255f28
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/controllers/posts_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 8255f28

Please sign in to comment.