Story: #104525314 - send error message to user if hold and inManualZone

This commit is contained in:
Matt Farnsworth 2015-10-28 17:47:18 +02:00
parent d17366405b
commit 8744f23928
2 changed files with 7 additions and 1 deletions

View file

@ -52,7 +52,7 @@ class Admin::DomainsController < AdminController
redirect_to [:admin, @domain]
else
build_associations
flash.now[:alert] = I18n.t('failed_to_update_domain')
flash.now[:alert] = I18n.t('failed_to_update_domain') + ' ' + @domain.errors.full_messages.join(", ")
render 'edit'
end
end

View file

@ -109,6 +109,12 @@ class Domain < ActiveRecord::Base
errors.add(:base, :invalid_auth_information_reserved)
end
validate :status_is_consistant
def status_is_consistant
has_error = (statuses.include?(DomainStatus::SERVER_HOLD) && statuses.include?(DomainStatus::SERVER_MANUAL_INZONE))
errors.add(:domains, I18n.t(:object_status_prohibits_operation)) if has_error
end
attr_accessor :is_admin
validate :check_permissions, :unless => :is_admin