Flowdock
new(config_or_deprecated_connection, deprecated_logger = nil, deprecated_connection_options = nil, deprecated_config = nil) public

No documentation

This method has no description. You can help the Ruby on Rails community by adding new notes.

Hide source
# File activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 128
      def initialize(config_or_deprecated_connection, deprecated_logger = nil, deprecated_connection_options = nil, deprecated_config = nil) # :nodoc:
        super()

        @raw_connection = nil
        @unconfigured_connection = nil

        if config_or_deprecated_connection.is_a?(Hash)
          @config = config_or_deprecated_connection.symbolize_keys
          @logger = ActiveRecord::Base.logger

          if deprecated_logger || deprecated_connection_options || deprecated_config
            raise ArgumentError, "when initializing an ActiveRecord adapter with a config hash, that should be the only argument"
          end
        else
          # Soft-deprecated for now; we'll probably warn in future.

          @unconfigured_connection = config_or_deprecated_connection
          @logger = deprecated_logger || ActiveRecord::Base.logger
          if deprecated_config
            @config = (deprecated_config || {}).symbolize_keys
            @connection_parameters = deprecated_connection_options
          else
            @config = (deprecated_connection_options || {}).symbolize_keys
            @connection_parameters = nil
          end
        end

        @owner = nil
        @instrumenter = ActiveSupport::Notifications.instrumenter
        @pool = ActiveRecord::ConnectionAdapters::NullPool.new
        @idle_since = Process.clock_gettime(Process::CLOCK_MONOTONIC)
        @visitor = arel_visitor
        @statements = build_statement_pool
        self.lock_thread = nil

        @prepared_statements = !ActiveRecord.disable_prepared_statements && self.class.type_cast_config_to_boolean(
          @config.fetch(:prepared_statements) { default_prepared_statements }
        )

        @advisory_locks_enabled = self.class.type_cast_config_to_boolean(
          @config.fetch(:advisory_locks, true)
        )

        @default_timezone = self.class.validate_default_timezone(@config[:default_timezone])

        @raw_connection_dirty = false
        @verified = false
      end
Register or log in to add new notes.