The code powering m.abunchtell.com https://m.abunchtell.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

28 lines
643 B

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