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

@ -320,7 +320,7 @@ class Panel::Announcement::BackEnd::BulletinsController < OrbitBackendController
protected protected
def delete_out_invalid_date_from_params() def delete_out_invalid_date_from_params()
if(params[:bulletin]["deadline(1i)"].empty? or params[:bulletin]["deadline(2i)"].empty? orparams[:bulletin]["deadline(3i)"].empty?) if(params[:bulletin]["deadline(1i)"].empty? or params[:bulletin]["deadline(2i)"].empty? or params[:bulletin]["deadline(3i)"].empty?)
params[:bulletin].delete("deadline(1i)") params[:bulletin].delete("deadline(1i)")
params[:bulletin].delete("deadline(2i)") params[:bulletin].delete("deadline(2i)")
params[:bulletin].delete("deadline(3i)") params[:bulletin].delete("deadline(3i)")

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'