Class: Announcement
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Announcement
- Defined in:
- app/models/announcement.rb
Class Method Summary collapse
Class Method Details
.current(hidden_ids = nil) ⇒ Object
10 11 12 13 14 |
# File 'app/models/announcement.rb', line 10 def self.current(hidden_ids = nil) result = where("(starts_at <= :now and ends_at >= :now) OR starts_at IS :null", now: Time.current, null: nil) result = result.where("id not in (?)", hidden_ids) if hidden_ids.present? result end |