Check IP in registrar

This commit is contained in:
Martin Lensment 2015-05-20 15:43:25 +03:00
parent 19e133ec6a
commit 940355a417
4 changed files with 33 additions and 2 deletions

View file

@ -24,4 +24,17 @@ class WhiteIp < ActiveRecord::Base
scope :repp, -> { where(interface: REPP) }
scope :registrar, -> { where(interface: REGISTRAR) }
scope :global, -> { where(interface: GLOBAL) }
class << self
def registrar_ip_white?(ip)
at = WhiteIp.arel_table
WhiteIp.where(
at[:interface].eq(REGISTRAR).or(
at[:interface].eq(GLOBAL)
).and(
at[:ipv4].eq(ip)
)
)
end
end
end