mirror of
https://github.com/internetee/registry.git
synced 2025-08-06 01:35:10 +02:00
Added linked and ok statuses
This commit is contained in:
parent
1f7ef2254e
commit
4f417d22da
5 changed files with 79 additions and 9 deletions
|
@ -42,13 +42,10 @@ class Contact < ActiveRecord::Base
|
|||
before_create :generate_code
|
||||
before_create :generate_auth_info
|
||||
after_create :ensure_disclosure
|
||||
after_save :manage_automatic_statuses
|
||||
def manage_automatic_statuses
|
||||
if statuses.empty? && valid?
|
||||
statuses.create(value: ContactStatus::OK)
|
||||
elsif statuses.length > 1 || !valid?
|
||||
statuses.find_by(value: ContactStatus::OK).try(:destroy)
|
||||
end
|
||||
after_save :manage_statuses
|
||||
def manage_statuses
|
||||
ContactStatus.manage(statuses, self)
|
||||
statuses.reload
|
||||
end
|
||||
|
||||
scope :current_registrars, ->(id) { where(registrar_id: id) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue