Skip to content

Instantly share code, notes, and snippets.

@matthewrudy
Created February 26, 2010 12:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewrudy/315671 to your computer and use it in GitHub Desktop.
Save matthewrudy/315671 to your computer and use it in GitHub Desktop.
Minimal implementation of ARel
class ActiveRecord::Base
class << self
# Model.order("awesomeness DESC")
def order(options)
self.scoped(:order => options)
end
# where(:type => "icecream").where(:flavour => "chocolate")
def where(options)
self.scoped(:conditions => options)
end
# joins(:users)
def joins(options)
self.scoped(:joins => options)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment