Created
November 10, 2008 19:06
-
-
Save kastner/23586 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| named_scope :newest_first, :order => "start_at desc" | |
| named_scope :ending_first, :order => "end_at" | |
| named_scope :past_day, :conditions => ["start_at >= ? AND start_at <= ?", Time.now - 1.day, Time.now] | |
| named_scope :does_expire, :conditions => { :does_not_expire => false} | |
| named_scope :never_expire, :conditions => { :does_not_expire => true} | |
| named_scope :active1, :conditions => { :status => true } | |
| named_scope :started, :conditions => ["start_at <= ? OR start_at IS NULL", Time.now] | |
| named_scope :not_ended, :conditions => ["end_at >= ? OR end_at IS NULL", Time.now] | |
| named_scope :ending, :conditions => ["end_at >= ? AND end_at <= ?", Time.now, Time.now + 7.days] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment