about summary refs log tree commit diff
path: root/app/models/domain_block.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/domain_block.rb')
-rw-r--r--app/models/domain_block.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/app/models/domain_block.rb b/app/models/domain_block.rb
index 89c81f766..baf5c3973 100644
--- a/app/models/domain_block.rb
+++ b/app/models/domain_block.rb
@@ -7,6 +7,9 @@ class DomainBlock < ApplicationRecord
 
   validates :domain, presence: true, uniqueness: true
 
+  has_many :accounts, foreign_key: :domain, primary_key: :domain
+  delegate :count, to: :accounts, prefix: true
+
   def self.blocked?(domain)
     where(domain: domain, severity: :suspend).exists?
   end