mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 01:35:10 +02:00
Refactor
This commit is contained in:
parent
44424984f0
commit
ef0eb7cbc6
2 changed files with 33 additions and 8 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue