Add InetContainer with scopes of containing and contained (#32802)
This commit is contained in:
10
app/models/concerns/inet_container.rb
Normal file
10
app/models/concerns/inet_container.rb
Normal file
@@ -0,0 +1,10 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
module InetContainer
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
scope :containing, ->(value) { where('ip >>= ?', value) }
|
||||
scope :contained_by, ->(value) { where('ip <<= ?', value) }
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user