2020-10-02 08:09:03 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class IssueEmailParticipant < ApplicationRecord
|
|
|
|
belongs_to :issue
|
|
|
|
|
2021-02-22 07:10:38 -05:00
|
|
|
validates :email, uniqueness: { scope: [:issue_id], case_sensitive: false }
|
2020-10-02 08:09:03 -04:00
|
|
|
validates :issue, presence: true
|
|
|
|
validate :validate_email_format
|
|
|
|
|
|
|
|
def validate_email_format
|
|
|
|
self.errors.add(:email, I18n.t(:invalid, scope: 'valid_email.validations.email')) unless ValidateEmail.valid?(self.email)
|
|
|
|
end
|
|
|
|
end
|