Guest User

Untitled

a guest
Feb 20th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. named_scope :newest_first, :order => "start_at desc"
  2. named_scope :ending_first, :order => "end_at"
  3. named_scope :past_day, :conditions => ["start_at >= ? AND start_at <= ?", Time.now - 1.day, Time.now]
  4. named_scope :does_expire, :conditions => { :does_not_expire => false}
  5. named_scope :never_expire, :conditions => { :does_not_expire => true}
  6. named_scope :active1, :conditions => { :status => true }
  7. named_scope :started, :conditions => ["start_at <= ? OR start_at IS NULL", Time.now]
  8. named_scope :not_ended, :conditions => ["end_at >= ? OR end_at IS NULL", Time.now]
  9. named_scope :ending, :conditions => ["end_at >= ? AND end_at <= ?", Time.now, Time.now + 7.days]
Add Comment
Please, Sign In to add comment