Skip to content

Instantly share code, notes, and snippets.

@neilmiddleton
Created April 28, 2010 13:11
Show Gist options
  • Save neilmiddleton/382118 to your computer and use it in GitHub Desktop.
Save neilmiddleton/382118 to your computer and use it in GitHub Desktop.
# Store named scopes
active = User.scoped(:conditions => {:active => true})
recent = User.scoped(:conditions => ['created_at > ?', 7.days.ago])
# Which can be combined
recent_active = recent.active
# And operated upon
recent_active.each { |u| ... }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment