Add verification methods

This commit is contained in:
Alex Sherman 2020-06-05 17:21:43 +05:00
parent cc142076c3
commit 9ae85f3d74
2 changed files with 12 additions and 2 deletions

View file

@ -3,12 +3,12 @@ module Concerns
extend ActiveSupport::Concern
def email_verification
EmailAddressVerification.find_by(email: self.email)
EmailAddressVerification.find_or_create_by(email: self.email)
end
def billing_email_verification
if self.attribute_names.include?('billing_email')
EmailAddressVerification.find_by(email: self.billing_email)
EmailAddressVerification.find_or_create_by(email: self.billing_email)
else
nil
end