Modified white ip form and created mailer

This commit is contained in:
Sergei Tsoganov 2023-07-05 15:28:43 +03:00
parent 311834c085
commit e00e44c9b8
10 changed files with 83 additions and 21 deletions

View file

@ -7,8 +7,6 @@ class WhiteIp < ApplicationRecord
attr_accessor :address
validate :validate_address_format
validates :ipv4, uniqueness: { scope: :registrar_id }, if: :ipv4?
validates :ipv6, uniqueness: { scope: :registrar_id }, if: :ipv6?
validate :validate_only_one_ip
validate :valid_ipv4?
validate :valid_ipv6?
@ -68,7 +66,7 @@ class WhiteIp < ApplicationRecord
API = 'api'.freeze
REGISTRAR = 'registrar'.freeze
INTERFACES = [API, REGISTRAR].freeze
INTERFACES = [REGISTRAR, API].freeze
scope :api, -> { where('interfaces @> ?::varchar[]', "{#{API}}") }
scope :registrar_area, -> { where('interfaces @> ?::varchar[]', "{#{REGISTRAR}}") }