Created
August 30, 2010 18:08
-
-
Save rafmagana/557791 to your computer and use it in GitHub Desktop.
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
config.after_initialize do | |
[User, And, All, The, Models, You, Want].each do |model| | |
model.class_eval do | |
include FakeActiveRecord3Methods | |
end | |
end | |
end |
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
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