diff options
Diffstat (limited to 'app/models/account.rb')
-rw-r--r-- | app/models/account.rb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/app/models/account.rb b/app/models/account.rb index 2a10f8345..f8a6dd703 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -68,6 +68,7 @@ class Account < ApplicationRecord scope :suspended, -> { where(suspended: true) } scope :recent, -> { reorder(id: :desc) } scope :alphabetic, -> { order(domain: :asc, username: :asc) } + scope :by_domain_accounts, -> { group(:domain).select(:domain, 'COUNT(*) AS accounts_count').order('accounts_count desc') } def follow!(other_account) active_relationships.where(target_account: other_account).first_or_create!(target_account: other_account) |