Module: ActiveRecord::ConnectionHandling
- Defined in:
- lib/active_record/connection_adapters/duckdb_adapter.rb
Instance Method Summary collapse
-
#duckdb_connection(config) ⇒ ActiveRecord::ConnectionAdapters::DuckdbAdapter
deprecated
Deprecated.
This method is provided for legacy compatibility only. In Rails 8+, adapters are registered via ActiveRecord::ConnectionAdapters.register and connections are created by calling AdapterClass.new(config) directly. Use ActiveRecord::Base.establish_connection instead for standard Rails usage.
Instance Method Details
#duckdb_connection(config) ⇒ ActiveRecord::ConnectionAdapters::DuckdbAdapter
Deprecated.
This method is provided for legacy compatibility only. In Rails 8+, adapters are registered via ActiveRecord::ConnectionAdapters.register and connections are created by calling AdapterClass.new(config) directly. Use ActiveRecord::Base.establish_connection instead for standard Rails usage.
Establishes a connection to a DuckDB database
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/active_record/connection_adapters/duckdb_adapter.rb', line 42 def duckdb_connection(config) config = config.symbolize_keys begin # Create adapter and establish connection via Rails lifecycle # connect! calls verify! which calls reconnect! and configure_connection adapter = ConnectionAdapters::DuckdbAdapter.new(nil, logger, {}, config) adapter.connect! adapter rescue StandardError => e raise ActiveRecord::ConnectionNotEstablished, "Could not connect to DuckDB database: #{e.}" end end |