lib/rails3_bridge.rb in rails3_bridge-0.1.1 vs lib/rails3_bridge.rb in rails3_bridge-0.1.2
- old
+ new
@@ -40,5 +40,47 @@
options = options.proxy_options if options.respond_to?(:proxy_options)
super(name, options, &block)
end
end
end
+
+module ActiveRecord
+ module Associations
+ class AssociationProxy
+ def self.where(*args)
+ self.scoped :conditions => args.length == 1 ? args[0] : args
+ end
+
+ def self.joins(*args)
+ self.scoped :joins => args.length == 1 ? args[0] : args
+ end
+
+ def self.includes(*args)
+ self.scoped :include => args.length == 1 ? args[0] : args
+ end
+
+ def self.select(arg)
+ self.scoped :select => arg
+ end
+
+ def self.order(arg)
+ self.scoped :order => arg
+ end
+
+ def self.limit(arg)
+ self.scoped :limit => arg
+ end
+
+ def self.offset(arg)
+ self.scoped :offset => arg
+ end
+
+ def self.group(arg)
+ self.scoped :group => arg
+ end
+
+ def self.having(arg)
+ self.scoped :having => arg
+ end
+ end
+ end
+end