diff --git a/app/models/ip_block.rb b/app/models/ip_block.rb index d6242efbf..5ed4d2a84 100644 --- a/app/models/ip_block.rb +++ b/app/models/ip_block.rb @@ -36,9 +36,14 @@ class IpBlock < ApplicationRecord class << self def blocked?(remote_ip) - blocked_ips_map = Rails.cache.fetch(CACHE_KEY) { FastIpMap.new(IpBlock.where(severity: :no_access).pluck(:ip)) } blocked_ips_map.include?(remote_ip) end + + private + + def blocked_ips_map + Rails.cache.fetch(CACHE_KEY) { FastIpMap.new(severity_no_access.pluck(:ip)) } + end end private