Created
February 26, 2010 12:09
-
-
Save matthewrudy/315671 to your computer and use it in GitHub Desktop.
Minimal implementation of ARel
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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