The code powering m.abunchtell.com https://m.abunchtell.com
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 

32 linhas
733 B

  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: account_domain_blocks
  5. #
  6. # id :bigint(8) not null, primary key
  7. # domain :string
  8. # created_at :datetime not null
  9. # updated_at :datetime not null
  10. # account_id :bigint(8)
  11. #
  12. class AccountDomainBlock < ApplicationRecord
  13. include Paginable
  14. belongs_to :account
  15. validates :domain, presence: true, uniqueness: { scope: :account_id }
  16. after_commit :remove_blocking_cache
  17. after_commit :remove_relationship_cache
  18. private
  19. def remove_blocking_cache
  20. Rails.cache.delete("exclude_domains_for:#{account_id}")
  21. end
  22. def remove_relationship_cache
  23. Rails.cache.delete_matched("relationship:#{account_id}:*")
  24. end
  25. end