mirror of
https://github.com/internetee/registry.git
synced 2025-05-28 16:39:55 +02:00
Story#108091488 - Seems that now reserved domains will be in better table
This commit is contained in:
parent
3c33a44f38
commit
6415bfae38
4 changed files with 34 additions and 16 deletions
|
@ -2,7 +2,7 @@ class Admin::ReservedDomainsController < AdminController
|
|||
load_and_authorize_resource
|
||||
|
||||
def index
|
||||
names = ReservedDomain.pluck(:names).each_with_object({}){|e_h,h| h.merge!(e_h)}
|
||||
names = ReservedDomain.pluck(:name, :password).each_with_object({}){|domain, hash| hash[domain[0]] = domain[1]}
|
||||
names.names = nil if names.blank?
|
||||
@reserved_domains = names.to_yaml.gsub(/---.?\n/, '').gsub(/\.\.\..?\n/, '')
|
||||
end
|
||||
|
@ -28,9 +28,8 @@ class Admin::ReservedDomainsController < AdminController
|
|||
|
||||
#updating and adding
|
||||
names.each do |name, psw|
|
||||
rec = ReservedDomain.by_domain(name).first
|
||||
rec ||= ReservedDomain.new
|
||||
rec.names = {name => psw}
|
||||
rec = ReservedDomain.find_or_initialize_by(name: name)
|
||||
rec.password = psw
|
||||
|
||||
unless rec.save
|
||||
result = false
|
||||
|
@ -39,7 +38,6 @@ class Admin::ReservedDomainsController < AdminController
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
if result
|
||||
flash[:notice] = I18n.t('record_updated')
|
||||
redirect_to :back
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue