Skip to content

Instantly share code, notes, and snippets.

@rafmagana
Created August 30, 2010 18:08
Show Gist options
  • Save rafmagana/557791 to your computer and use it in GitHub Desktop.
Save rafmagana/557791 to your computer and use it in GitHub Desktop.
config.after_initialize do
[User, And, All, The, Models, You, Want].each do |model|
model.class_eval do
include FakeActiveRecord3Methods
end
end
end
module FakeActiveRecord3Methods
def self.included(base)
base.class_eval do
%w/select group order limit offset joins having/.each do |method|
named_scope method.to_sym, lambda { |arg| { method.to_sym => arg } }
end
named_scope :where, lambda { |arg| { :conditions => arg } }
named_scope :includes, lambda { |arg| { :include => arg } }
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment