instance method configure_connection

Ruby on Rails 8.0.4

Since v5.2.8.1 Private

Available in: v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

configure_connection()

No documentation comment.

Source
# File activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb, line 820
        def configure_connection
          if @config[:timeout] && @config[:retries]
            raise ArgumentError, "Cannot specify both timeout and retries arguments"
          elsif @config[:timeout]
            timeout = self.class.type_cast_config_to_integer(@config[:timeout])
            raise TypeError, "timeout must be integer, not #{timeout}" unless timeout.is_a?(Integer)
            @raw_connection.busy_handler_timeout = timeout
          elsif @config[:retries]
            ActiveRecord.deprecator.warn(<<~MSG)
              The retries option is deprecated and will be removed in Rails 8.1. Use timeout instead.
            MSG
            retries = self.class.type_cast_config_to_integer(@config[:retries])
            raw_connection.busy_handler { |count| count <= retries }
          end

          super

          pragmas = @config.fetch(:pragmas, {}).stringify_keys
          DEFAULT_PRAGMAS.merge(pragmas).each do |pragma, value|
            if ::SQLite3::Pragmas.method_defined?("#{pragma}=")
              @raw_connection.public_send("#{pragma}=", value)
            else
              warn "Unknown SQLite pragma: #{pragma}"
            end
          end
        end

Defined in activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb line 820 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionAdapters::SQLite3Adapter

Type at least 2 characters to search.

↑↓ navigate · open · esc close