lib/rage-rb.rb in rage-rb-1.9.0 vs lib/rage-rb.rb in rage-rb-1.10.0
- old
+ new
@@ -63,12 +63,14 @@
patch = proc do
is_connected = ActiveRecord::Base.connection_pool rescue false
if is_connected
puts "INFO: Patching ActiveRecord::ConnectionPool"
Iodine.on_state(:on_start) do
- ActiveRecord::Base.connection_pool.extend(Rage::Ext::ActiveRecord::ConnectionPool)
- ActiveRecord::Base.connection_pool.__init_rage_extension
+ ActiveRecord::Base.connection_handler.connection_pool_list(:all).each do |pool|
+ pool.extend(Rage::Ext::ActiveRecord::ConnectionPool)
+ pool.__init_rage_extension
+ end
end
else
puts "WARNING: DB connection is not established - can't patch ActiveRecord::ConnectionPool"
end
end
@@ -78,10 +80,14 @@
else
patch.call
end
end
+ def self.load_tasks
+ Rage::Tasks.init
+ end
+
# @private
def self.with_middlewares(app, middlewares)
middlewares.reverse.inject(app) do |next_in_chain, (middleware, args, block)|
# in Rails compatibility mode we first check if the middleware is a part of the Rails middleware stack;
# if it is - it is expected to be built using `ActionDispatch::MiddlewareStack::Middleware#build`
@@ -109,9 +115,10 @@
module ActiveRecord
autoload :ConnectionPool, "rage/ext/active_record/connection_pool"
end
end
+ autoload :Tasks, "rage/tasks"
autoload :Cookies, "rage/cookies"
autoload :Session, "rage/session"
autoload :Cable, "rage/cable/cable"
end