Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Announcement < ActiveRecord::Base
- named_scope :active, lambda { { :conditions => ['starts_at <= ? AND ends_at >= ?', Time.now.utc, Time.now.utc] } }
- named_scope :since, lambda { |hide_time| { :conditions => (hide_time ? ['updated_at > ? OR starts_at > ?', hide_time.utc, hide_time.utc] : nil) } }
- def self.current_announcements(hide_time)
- active.since(hide_time)
- end
- end
Add Comment
Please, Sign In to add comment