diff --git a/app/models/dispute.rb b/app/models/dispute.rb index a21ef28f7..031e15855 100644 --- a/app/models/dispute.rb +++ b/app/models/dispute.rb @@ -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 diff --git a/app/views/admin/disputes/_form.html.erb b/app/views/admin/disputes/_form.html.erb index df2151c6c..2a3fb722f 100644 --- a/app/views/admin/disputes/_form.html.erb +++ b/app/views/admin/disputes/_form.html.erb @@ -36,7 +36,7 @@
<%= f.text_field(:starts_at, class: 'form-control js-datepicker') %> - <%= t '.in_future' %> + <%= t '.past_or_today' %>
diff --git a/config/locales/admin/disputes.en.yml b/config/locales/admin/disputes.en.yml index ba5b79099..072f0eebc 100644 --- a/config/locales/admin/disputes.en.yml +++ b/config/locales/admin/disputes.en.yml @@ -1,4 +1,11 @@ en: + activerecord: + errors: + models: + dispute: + attributes: + starts_at: + future: 'can not be greater than today' admin: disputes: index: @@ -9,4 +16,4 @@ en: form: password_hint: Generated automatically if left blank optional: Not required by default - in_future: Must be at least today / in future + past_or_today: Can not be greater than today's date