lib/connection_manager/using.rb in connection_manager-1.1.0 vs lib/connection_manager/using.rb in connection_manager-1.1.1
- old
+ new
@@ -1,7 +1,23 @@
module ConnectionManager
module Using
+ module ClassMethods
+ def >=(compare)
+ return self >= compare.klass if compare.is_a?(ConnectionManager::Using::Proxy)
+ super(compare)
+ end
+
+ def ==(compare)
+ return self == compare.klass if compare.is_a?(ConnectionManager::Using::Proxy)
+ super(compare)
+ end
+
+ def !=(compare)
+ return self != compare.klass if compare.is_a?(ConnectionManager::Using::Proxy)
+ super(compare)
+ end
+ end
class Proxy
attr_accessor :klass, :connection_class
def initialize(klass,connection_class)
@klass = klass # the @klass from an ActiveRecord::Relation
@@ -59,5 +75,7 @@
@klass.respond_to?(method_name) || super
end
end
end
end
+ActiveRecord::Relation.send(:extend, ConnectionManager::Using::ClassMethods)
+ActiveRecord::Base.send(:extend, ConnectionManager::Using::ClassMethods)