mirror of
https://github.com/internetee/registry.git
synced 2025-05-18 18:29:40 +02:00
111297422-mask_fix
This commit is contained in:
parent
11d543d967
commit
4a0b1fea39
1 changed files with 2 additions and 3 deletions
|
@ -4,7 +4,7 @@ class Admin::BlockedDomainsController < AdminController
|
||||||
def index
|
def index
|
||||||
bd = BlockedDomain.pluck(:name)
|
bd = BlockedDomain.pluck(:name)
|
||||||
if bd
|
if bd
|
||||||
@blocked_domains = bd.to_yaml.gsub("---\n", '').gsub("-", '').gsub(/\.\.\..?\n/, '')
|
@blocked_domains = bd.to_yaml.gsub("---\n", '').gsub("-", '').gsub(" ", '')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -21,13 +21,12 @@ class Admin::BlockedDomainsController < AdminController
|
||||||
render :index and return
|
render :index and return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
names = names.split(' ')
|
||||||
result = true
|
result = true
|
||||||
BlockedDomain.transaction do
|
BlockedDomain.transaction do
|
||||||
# removing old ones
|
|
||||||
existing = BlockedDomain.any_of_domains(names).pluck(:id)
|
existing = BlockedDomain.any_of_domains(names).pluck(:id)
|
||||||
BlockedDomain.where.not(id: existing).destroy_all
|
BlockedDomain.where.not(id: existing).destroy_all
|
||||||
|
|
||||||
#updating and adding
|
|
||||||
names.each do |name|
|
names.each do |name|
|
||||||
rec = BlockedDomain.find_or_initialize_by(name: name)
|
rec = BlockedDomain.find_or_initialize_by(name: name)
|
||||||
unless rec.save
|
unless rec.save
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue