Fix IP blocks not having a unique index (#19456)
This commit is contained in:
@@ -5,7 +5,7 @@ module Admin
|
||||
def index
|
||||
authorize :ip_block, :index?
|
||||
|
||||
@ip_blocks = IpBlock.page(params[:page])
|
||||
@ip_blocks = IpBlock.order(ip: :asc).page(params[:page])
|
||||
@form = Form::IpBlockBatch.new
|
||||
end
|
||||
|
||||
|
@@ -25,6 +25,7 @@ class IpBlock < ApplicationRecord
|
||||
}
|
||||
|
||||
validates :ip, :severity, presence: true
|
||||
validates :ip, uniqueness: true
|
||||
|
||||
after_commit :reset_cache
|
||||
|
||||
|
Reference in New Issue
Block a user