This commit is contained in:
nccu 2015-03-17 15:34:06 +08:00
parent 47c8900a5d
commit d8a49dfdfa
1 changed files with 2 additions and 2 deletions

View File

@ -49,7 +49,7 @@ class Bulletin
return true
end
# before_save :fetch_dept
before_save :fetch_dept
scope :can_display, ->{where(:is_hidden=>false,:is_preview => false).any_of({:postdate.lt=>Time.now, :deadline.gt=>Time.now},{:postdate.lt=>Time.now, :deadline=>nil}).order_by([:is_top, :desc])}
scope :is_approved, ->{where(:approved => true)}
@ -107,7 +107,7 @@ class Bulletin
protected
def fetch_dept
refetch_dept if self.new_record?
refetch_dept if self.new_record? && !self.is_preview
end
end