mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 11:16:00 +02:00
Make dispute domain_name read only
This commit is contained in:
parent
483eec554e
commit
928f96691c
1 changed files with 4 additions and 2 deletions
|
@ -1,5 +1,3 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class Dispute < ApplicationRecord
|
||||
validates :domain_name, :password, :starts_at, :expires_at, presence: true
|
||||
before_validation :fill_empty_passwords
|
||||
|
@ -10,6 +8,7 @@ class Dispute < ApplicationRecord
|
|||
with_options on: :admin do
|
||||
validate :validate_start_date
|
||||
end
|
||||
|
||||
before_save :set_expiry_date
|
||||
before_save :sync_reserved_password
|
||||
before_save :generate_data
|
||||
|
@ -19,6 +18,8 @@ class Dispute < ApplicationRecord
|
|||
scope :active, -> { where('expires_at >= ? AND closed = false', Time.zone.today) }
|
||||
scope :closed, -> { where(closed: true) }
|
||||
|
||||
attr_readonly :domain_name
|
||||
|
||||
alias_attribute :name, :domain_name
|
||||
|
||||
def self.close_by_domain(domain_name)
|
||||
|
@ -97,6 +98,7 @@ class Dispute < ApplicationRecord
|
|||
private
|
||||
|
||||
def validate_start_date
|
||||
puts 'EXECUTED'
|
||||
return if starts_at.nil?
|
||||
|
||||
errors.add(:starts_at, :past) if starts_at.past?
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue