Fix can_display for status ordering and hidden

This commit is contained in:
manson 2014-06-06 19:17:58 +08:00
parent af6e7d5ac5
commit b5962ea4bf
1 changed files with 2 additions and 4 deletions

View File

@ -34,6 +34,8 @@ class Bulletin
before_destroy :destroy_email before_destroy :destroy_email
scope :can_display, ->{where(:is_hidden=>false).any_of({:postdate.lt=>Time.now, :deadline.gt=>Time.now},{:postdate.lt=>Time.now, :deadline=>nil}).order_by([:is_top, :desc])}
def update_user def update_user
User.find(update_user_id) rescue nil User.find(update_user_id) rescue nil
end end
@ -42,10 +44,6 @@ class Bulletin
self.update_user_id = user.id self.update_user_id = user.id
end end
def self.can_display()
self.any_of({:postdate.lt=>Time.now, :deadline.gt=>Time.now},{:postdate.lt=>Time.now, :deadline=>nil})
end
def email_members def email_members
MemberProfile.find(self.email_member_ids) rescue [] MemberProfile.find(self.email_member_ids) rescue []
end end