From 8744f239289e1128977a38949cbf486d881d726a Mon Sep 17 00:00:00 2001 From: Matt Farnsworth Date: Wed, 28 Oct 2015 17:47:18 +0200 Subject: [PATCH] Story: #104525314 - send error message to user if hold and inManualZone --- app/controllers/admin/domains_controller.rb | 2 +- app/models/domain.rb | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) 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