end
end
-class MergeAclAddressAndMask < ActiveRecord::Migration
+class MergeAclAddressAndMask < ActiveRecord::Migration[4.2]
+ class Acl < ActiveRecord::Base
+ end
+
def up
Acl.find_each do |acl|
address = IPAddr.new(acl.address)
while netmask != "0.0.0.0"
netmask = netmask << 1
- prefix = prefix + 1
+ prefix += 1
end
acl.address = "#{address.mask(prefix)}/#{prefix}"