Skip to content

Instantly share code, notes, and snippets.

@skojin
Created May 21, 2010 15:24
Show Gist options
  • Save skojin/408973 to your computer and use it in GitHub Desktop.
Save skojin/408973 to your computer and use it in GitHub Desktop.
# rails 3 like, default scopes
module Rails3Scopes
def self.included(base)
base.named_scope :where, lambda{ |conditions| {:conditions => conditions} }
base.named_scope :order, lambda{ |order| {:order => order} }
base.named_scope :limit, lambda{ |n| {:limit => n} }
base.named_scope :joins, lambda{ |j| {:joins => j} }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment