Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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