From 8b2199e28c66a362c8bf3ce0b7b9d287c8428de3 Mon Sep 17 00:00:00 2001 From: nwb Date: Mon, 7 Jul 2014 15:01:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E7=AB=9E=E8=B5=9B=E6=97=B6?= =?UTF-8?q?=E7=9A=84=E6=97=A5=E6=9C=9F=E5=88=A4=E6=96=AD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/contest.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/contest.rb b/app/models/contest.rb index 7f6e10a8c..e1706b166 100644 --- a/app/models/contest.rb +++ b/app/models/contest.rb @@ -24,8 +24,9 @@ class Contest < ActiveRecord::Base validates_length_of :name, :maximum => NAME_LENGTH_LIMIT validates_length_of :description, :maximum => DESCRIPTION_LENGTH_LIMIT - validates_presence_of :author_id, :name, :deadline,:budget - validates_format_of :deadline, :with => /^[\d]{4}[-][\d]{1,2}[-][\d]{1,2}$/ + 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 =>/^[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})$/ validate :validate_user after_create :act_as_activity