mirror of
https://github.com/internetee/registry.git
synced 2025-07-22 18:56:05 +02:00
Validate Dispute.starts_at is not in future
This commit is contained in:
parent
529a8a1bf6
commit
5e152b3b9d
3 changed files with 11 additions and 7 deletions
|
@ -4,10 +4,7 @@ class Dispute < ApplicationRecord
|
|||
before_validation :set_expiry_date
|
||||
validate :validate_domain_name_format
|
||||
validate :validate_domain_name_period_uniqueness
|
||||
|
||||
with_options on: :admin do
|
||||
validate :validate_start_date
|
||||
end
|
||||
validate :validate_start_date
|
||||
|
||||
before_save :set_expiry_date
|
||||
before_save :sync_reserved_password
|
||||
|
@ -112,7 +109,7 @@ class Dispute < ApplicationRecord
|
|||
def validate_start_date
|
||||
return if starts_at.nil?
|
||||
|
||||
errors.add(:starts_at, :past) if starts_at.past?
|
||||
errors.add(:starts_at, :future) if starts_at.future?
|
||||
end
|
||||
|
||||
def validate_domain_name_format
|
||||
|
|
|
@ -36,7 +36,7 @@
|
|||
</div>
|
||||
<div class="col-md-7">
|
||||
<%= f.text_field(:starts_at, class: 'form-control js-datepicker') %>
|
||||
<span class="help-block"><%= t '.in_future' %></span>
|
||||
<span class="help-block"><%= t '.past_or_today' %></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue