lib/fresh_connection/railtie.rb in fresh_connection-0.2.1 vs lib/fresh_connection/railtie.rb in fresh_connection-0.2.2

- old
+ new

@@ -1,12 +1,19 @@ +require 'fresh_connection/rack/connection_management' require 'rails' module FreshConnection class Railtie < Rails::Railtie - initializer "fresh_connection.configure_rails_initialization" do |app| - Initializer.swap_rack(app) + config.fresh_connection = ActiveSupport::OrderedOptions.new + config.eager_load_namespaces << FreshConnection + initializer "fresh_connection.configure_rails_initialization" do |app| ActiveSupport.on_load(:active_record) do + app.config.app_middleware.swap( + ActiveRecord::ConnectionAdapters::ConnectionManagement, + FreshConnection::Rack::ConnectionManagement + ) + Initializer.extend_active_record end end end end