Skip to content

Instantly share code, notes, and snippets.

@curtis
Created July 21, 2009 16:41
Show Gist options
  • Save curtis/151450 to your computer and use it in GitHub Desktop.
Save curtis/151450 to your computer and use it in GitHub Desktop.
An example of named scopes
named_scope :archived, :conditions => ["archived_at IS NOT NULL AND archived_at <= ?", Time.now.utc]
named_scope :not_archived, :conditions => ["archived_at IS NULL OR archived_at > ?", Time.now.utc]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment