This commit is contained in:
Martin Lensment 2014-09-23 15:41:34 +03:00
parent 44424984f0
commit ef0eb7cbc6
2 changed files with 33 additions and 8 deletions

View file

@ -130,7 +130,7 @@ class Domain < ActiveRecord::Base
existing = domain_statuses.select { |x| x.value == status.value }
next unless existing.length > 1
validated << status.value
errors.add(:domain_statuses, :invalid)
errors.add(:domain_statuses, :invalid) if errors[:domain_statuses].blank?
status.errors.add(:value, :taken)
end
end
@ -161,6 +161,15 @@ class Domain < ActiveRecord::Base
(errors.keys - assoc_errors).empty?
end
def general_tab_valid?
status_errors = errors.keys.collect { |x| x.match(/domain_statuses/) }
(errors.keys - status_errors).empty?
end
def statuses_tab_valid?
!errors.keys.any? { |x| x.match(/domain_statuses/) }
end
## SHARED
def to_s