新建竞赛时的日期判断优化

This commit is contained in:
nwb 2014-07-07 15:01:10 +08:00
parent ae32b310cd
commit 8b2199e28c
1 changed files with 3 additions and 2 deletions

View File

@ -24,8 +24,9 @@ class Contest < ActiveRecord::Base
validates_length_of :name, :maximum => NAME_LENGTH_LIMIT validates_length_of :name, :maximum => NAME_LENGTH_LIMIT
validates_length_of :description, :maximum => DESCRIPTION_LENGTH_LIMIT validates_length_of :description, :maximum => DESCRIPTION_LENGTH_LIMIT
validates_presence_of :author_id, :name, :deadline,:budget validates_presence_of :author_id, :name, :budget
validates_format_of :deadline, :with => /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/ #validates_format_of :deadline, :with => /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/
validates_format_of :deadline, :with =>/^[1-9][0-9]{3}\-0?[1-9]|1[12]\-0?[1-9]|[12]\d|3[01]$/
# validates_format_of :budget, :with => /^(\d+)$|^(\d+).([0-9]{2})|^(\d+).([0-9]{1})$/ # validates_format_of :budget, :with => /^(\d+)$|^(\d+).([0-9]{2})|^(\d+).([0-9]{1})$/
validate :validate_user validate :validate_user
after_create :act_as_activity after_create :act_as_activity