Sha256: 6670456bbf9db985b7504d5e291248ba64ea92a1137b1be004b2a536a50cb8f5

Contents?: true

Size: 783 Bytes

Versions: 4

Compression:

Stored size: 783 Bytes

Contents

# frozen_string_literal: true

module FreshConnection
  class ConnectionSpecification
    module Rails60
      def spec
        ActiveRecord::ConnectionAdapters::ConnectionSpecification::Resolver.new(config_with_spec_name).spec(@spec_name.to_sym)
      end

      private

      def config_with_spec_name
        if defined?(ActiveRecord::DatabaseConfigurations)
          ActiveRecord::DatabaseConfigurations.new(@spec_name => build_config)
        else
          { @spec_name => build_config }
        end
      end

      def config_from_url
        ActiveRecord::ConnectionAdapters::ConnectionSpecification::ConnectionUrlResolver.new(database_group_url).to_hash
      end

      def base_config
        ActiveRecord::Base.connection_pool.spec.config
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fresh_connection-3.1.3 lib/fresh_connection/connection_specification/rails_60.rb
fresh_connection-3.1.2 lib/fresh_connection/connection_specification/rails_60.rb
fresh_connection-3.1.1 lib/fresh_connection/connection_specification/rails_60.rb
fresh_connection-3.1.1.rc1 lib/fresh_connection/connection_specification/rails_60.rb