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.

17 lines
428 B

  1. # frozen_string_literal: true
  2. # == Schema Information
  3. #
  4. # Table name: email_domain_blocks
  5. #
  6. # id :integer not null, primary key
  7. # domain :string not null
  8. # created_at :datetime not null
  9. # updated_at :datetime not null
  10. #
  11. class EmailDomainBlock < ApplicationRecord
  12. def self.block?(email)
  13. domain = email.gsub(/.+@([^.]+)/, '\1')
  14. where(domain: domain).exists?
  15. end
  16. end