1
0

unavailable_domain.rb 579 B

1234567891011121314151617181920212223242526272829
  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: unavailable_domains
  5. #
  6. # id :bigint(8) not null, primary key
  7. # domain :string default(""), not null
  8. # created_at :datetime not null
  9. # updated_at :datetime not null
  10. #
  11. class UnavailableDomain < ApplicationRecord
  12. include DomainNormalizable
  13. validates :domain, presence: true, uniqueness: true
  14. after_commit :reset_cache!
  15. def to_log_human_identifier
  16. domain
  17. end
  18. private
  19. def reset_cache!
  20. Rails.cache.delete('unavailable_domains')
  21. end
  22. end