mirror of
https://github.com/internetee/registry.git
synced 2025-07-05 18:53:26 +02:00
Story#116761157 - remove statuses uniqueness validation as no need any more
This commit is contained in:
parent
2e98e0f163
commit
66e7253dc3
1 changed files with 5 additions and 7 deletions
|
@ -34,7 +34,6 @@ class Contact < ActiveRecord::Base
|
|||
format: { with: /\A[\w\-\:\.\_]*\z/i, message: :invalid },
|
||||
length: { maximum: 100, message: :too_long_contact_code }
|
||||
validate :val_ident_valid_format?
|
||||
validate :uniq_statuses?
|
||||
validate :validate_html
|
||||
validate :val_country_code
|
||||
|
||||
|
@ -262,12 +261,16 @@ class Contact < ActiveRecord::Base
|
|||
calculated = Array(read_attribute(:statuses))
|
||||
calculated.delete(Contact::OK)
|
||||
calculated.delete(Contact::LINKED)
|
||||
calculated << Contact::OK if calculated.empty? && valid?
|
||||
calculated << Contact::OK if calculated.empty?# && valid?
|
||||
calculated << Contact::LINKED if domains_present?
|
||||
|
||||
calculated.uniq
|
||||
end
|
||||
|
||||
def statuses= arr
|
||||
write_attribute(:statuses, arr.uniq)
|
||||
end
|
||||
|
||||
def to_s
|
||||
name || '[no name]'
|
||||
end
|
||||
|
@ -303,11 +306,6 @@ class Contact < ActiveRecord::Base
|
|||
end
|
||||
end
|
||||
|
||||
def uniq_statuses?
|
||||
return true unless statuses.detect { |s| statuses.count(s) > 1 }
|
||||
errors.add(:statuses, :not_uniq)
|
||||
false
|
||||
end
|
||||
|
||||
def org?
|
||||
ident_type == ORG
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue