diff --git a/app/controllers/admin/domains_controller.rb b/app/controllers/admin/domains_controller.rb index 7c90c1a49..3240db931 100644 --- a/app/controllers/admin/domains_controller.rb +++ b/app/controllers/admin/domains_controller.rb @@ -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 diff --git a/app/models/domain.rb b/app/models/domain.rb index a28ede76f..7c925ea32 100644 --- a/app/models/domain.rb +++ b/app/models/domain.rb @@ -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