Period validation

This commit is contained in:
Martin Lensment 2014-07-30 13:55:02 +03:00
parent 6990da7675
commit 1e2dad06f9
6 changed files with 16 additions and 1 deletions

View file

@ -25,6 +25,7 @@ module Epp::DomainsHelper
name: ph[:name],
registrar_id: current_epp_user.registrar.try(:id),
registered_at: Time.now,
period: ph[:period].to_i,
valid_from: Date.today,
valid_to: Date.today + ph[:period].to_i.years,
auth_info: ph[:authInfo][:pw]

View file

@ -10,6 +10,7 @@ class Domain < ActiveRecord::Base
validates :name, domain_name: true, uniqueness: { message: I18n.t('errors.messages.epp_domain_taken') }
validates :name_puny, domain_name: true
validates :period, numericality: { only_integer: true, greater_than: 0, less_than: 100 }
def name=(value)
value.strip!