mirror of
https://github.com/internetee/registry.git
synced 2025-07-25 20:18:22 +02:00
Add email checking with validation event saving
This commit is contained in:
parent
d4fe961e34
commit
c344b91d84
4 changed files with 65 additions and 4 deletions
|
@ -1,9 +1,17 @@
|
|||
class ValidationEvent < ActiveRecord::Base
|
||||
# frozen_string_literal: true
|
||||
|
||||
# Class to store validation events. Need to include boolean `success` field - was validation event
|
||||
# successful or not.
|
||||
# Types of events supported so far stored in ValidationEvent::EventType::TYPES
|
||||
# For email_validation event kind also check_level (regex/mx/smtp) is stored in the event_data
|
||||
class ValidationEvent < ApplicationRecord
|
||||
enum event_type: ValidationEvent::EventType::TYPES, _suffix: true
|
||||
|
||||
store_accessor :event_data, :errors, :check_level, :email
|
||||
|
||||
belongs_to :validation_eventable, polymorphic: true
|
||||
|
||||
def event_type
|
||||
@event_type ||= ValidationEvent::EventType.new(read_attribute(:event_kind))
|
||||
@event_type ||= ValidationEvent::EventType.new(self[:event_kind])
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue