fix bugs.

This commit is contained in:
Matthew K. Fu JuYuan 2012-06-29 11:17:35 +08:00
parent 6c4c1046bc
commit f66c3d9c0c
2 changed files with 9 additions and 2 deletions

View File

@ -50,7 +50,7 @@ class Bulletin
validates_presence_of :title validates_presence_of :title
before_save :set_key, :update_status before_save :set_key, :update_status,:check_deadline
after_save :save_bulletin_links after_save :save_bulletin_links
after_save :save_bulletin_files after_save :save_bulletin_files
@ -159,6 +159,13 @@ class Bulletin
protected protected
def check_deadline
if(!self.deadline.nil? and (self.deadline<= self.postdate ))
self.deadline = nil
end
end
def set_key def set_key
if title && title.new_record? if title && title.new_record?
title.key = 'title' title.key = 'title'