]> cat aescling's git repositories - mastodon.git/commitdiff
Cache result of SQL (#14534)
authorniwatori24 <62463593+niwatori24@users.noreply.github.com>
Sun, 9 Aug 2020 13:23:42 +0000 (22:23 +0900)
committerGitHub <noreply@github.com>
Sun, 9 Aug 2020 13:23:42 +0000 (15:23 +0200)
app/models/form/custom_emoji_batch.rb

index 6b7ea5355dd1dcbd6c14fc0f77a7e02761a1acca..f4fa84c102cacd4f994c2e02f10d0e4f5e4881ce 100644 (file)
@@ -30,7 +30,7 @@ class Form::CustomEmojiBatch
   private
 
   def custom_emojis
-    CustomEmoji.where(id: custom_emoji_ids)
+    @custom_emojis ||= CustomEmoji.where(id: custom_emoji_ids)
   end
 
   def update!