Add counter caches for a large performance increase on API requests
This commit is contained in:
parent
333e44c3fc
commit
de22c202f5
13 changed files with 41 additions and 22 deletions
|
@ -3,8 +3,8 @@
|
|||
class Follow < ApplicationRecord
|
||||
include Paginable
|
||||
|
||||
belongs_to :account
|
||||
belongs_to :target_account, class_name: 'Account'
|
||||
belongs_to :account, counter_cache: :following_count
|
||||
belongs_to :target_account, class_name: 'Account', counter_cache: :followers_count
|
||||
|
||||
has_one :notification, as: :activity, dependent: :destroy
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue