From 55e150352204bc790345cf81ef02bfcb1d7e0594 Mon Sep 17 00:00:00 2001 From: Matt Jankowski Date: Tue, 18 Apr 2017 15:09:07 -0400 Subject: Instances list in admin (#2095) * Add admin/instances index action * Add link to instances admin page * View lists instances * Instances, grouped by domain, ordered by count * Use Account.remote scope * Extract method: Account.by_domain_accounts --- app/models/account.rb | 1 + 1 file changed, 1 insertion(+) (limited to 'app/models/account.rb') 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) -- cgit