Skip to content

Instantly share code, notes, and snippets.

@curtis
Created July 21, 2009 16:42
Show Gist options
  • Save curtis/151452 to your computer and use it in GitHub Desktop.
Save curtis/151452 to your computer and use it in GitHub Desktop.
An example of using named scope inside a plugin
named_scope :archived, lambda { { :conditions => ["archived_at IS NOT NULL AND archived_at <= ?", Time.now.utc] } }
named_scope :not_archived, lambda { { :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