DEV: Fix moving of rails_failover middleware.

DEV: Fix moving of rails_failover middleware.

diff --git a/config/initializers/200-first_middlewares.rb b/config/initializers/200-first_middlewares.rb
index ab53806..fc6c661 100644
--- a/config/initializers/200-first_middlewares.rb
+++ b/config/initializers/200-first_middlewares.rb
@@ -27,5 +27,9 @@ if Rails.configuration.multisite
 end
 
 if ENV["ACTIVE_RECORD_RAILS_FAILOVER"]
-  Rails.configuration.middleware.move_after(RailsMultisite::Middleware, RailsFailover::ActiveRecord::Middleware)
+  if Rails.configuration.multisite
+    Rails.configuration.middleware.move_after(RailsMultisite::Middleware, RailsFailover::ActiveRecord::Middleware)
+  else
+    Rails.configuration.middleware.move_before(MessageBus::Rack::Middleware, RailsFailover::ActiveRecord::Middleware)
+  end
 end

GitHub sha: 87673e65