instance method
configure_connection
Ruby on Rails 8.0.4
Since v5.2.8.1 PrivateSignature
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