This commit is contained in:
Martin Lensment 2014-09-15 16:54:25 +03:00
parent a9ee1cdad1
commit 76d397465e
2 changed files with 12 additions and 8 deletions

View file

@ -10,12 +10,18 @@ class Admin::NameserversController < ApplicationController
def create
@domain = Domain.find(params[:domain_id])
if @domain.can_add_nameserver?
@domain.nameservers.build(nameserver_params)
flash[:notice] = I18n.t('shared.nameserver_added')
redirect_to [:admin, @domain] and return if @domain.save
else
unless @domain.can_add_nameserver?
@nameserver = @domain.nameservers.build(nameserver_params)
flash.now[:alert] = I18n.t('shared.failed_to_add_nameserver')
render 'new' and return
end
@domain.nameservers.build(nameserver_params)
if @domain.save
flash[:notice] = I18n.t('shared.nameserver_added')
redirect_to [:admin, @domain]
else
flash.now[:alert] = I18n.t('shared.failed_to_add_nameserver')
render 'new'
end

View file

@ -2,9 +2,7 @@ class Admin::TechContactsController < ApplicationController
before_action :set_domain
before_action :set_contact, only: [:destroy]
def new
end
def new; end
def create
contact = Contact.find_by(id: params[:tech_contact_id])