about summary refs log tree commit diff
path: root/app/models/notification.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2016-11-30 15:57:56 +0100
committerEugen Rochko <eugen@zeonfederated.com>2016-11-30 15:57:56 +0100
commita21bcac9e156d8c40fe7c15c62ac71a901091cc5 (patch)
treeb02405fbe4fc288bfc74525c1eddcef1a86d9444 /app/models/notification.rb
parent356d3874ebd79573a8da58e2ac76eaa4612cec16 (diff)
Further abstract caching for includes
Diffstat (limited to 'app/models/notification.rb')
-rw-r--r--app/models/notification.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/app/models/notification.rb b/app/models/notification.rb
index c0537397c..b066cd87a 100644
--- a/app/models/notification.rb
+++ b/app/models/notification.rb
@@ -2,6 +2,7 @@
 
 class Notification < ApplicationRecord
   include Paginable
+  include Cacheable
 
   belongs_to :account
   belongs_to :activity, polymorphic: true
@@ -15,7 +16,7 @@ class Notification < ApplicationRecord
 
   STATUS_INCLUDES = [:account, :stream_entry, :media_attachments, :tags, mentions: :account, reblog: [:stream_entry, :account, :media_attachments, :tags, mentions: :account]].freeze
 
-  scope :with_includes, -> { includes(status: STATUS_INCLUDES, mention: [status: STATUS_INCLUDES], favourite: [:account, status: STATUS_INCLUDES], follow: :account) }
+  cache_associated status: STATUS_INCLUDES, mention: [status: STATUS_INCLUDES], favourite: [:account, status: STATUS_INCLUDES], follow: :account
 
   def activity
     send(activity_type.downcase)