Skip to content

Instantly share code, notes, and snippets.

@dmitriy-kiriyenko
Created October 15, 2010 11:19
Show Gist options
  • Save dmitriy-kiriyenko/628027 to your computer and use it in GitHub Desktop.
Save dmitriy-kiriyenko/628027 to your computer and use it in GitHub Desktop.
ActiveRecord 3 query interface for ActiveRecord 2
class ActiveRecord::Base
class << self
[:conditions, :order, :group, :having, :limit, :offset, :joins, :include, :select, :from, :readonly, :lock].each do |m|
send(:define_method, m) do |arg|
scoped(m => arg)
end
end
alias_method :where, :conditions
alias_method :start, :offset
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment