instance method
raw_connection
Ruby on Rails 7.1.6
Since v2.2.3Signature
raw_connection()
Provides access to the underlying database driver for this adapter. For example, this method returns a Mysql2::Client object in case of Mysql2Adapter, and a PG::Connection object in case of PostgreSQLAdapter.
This is useful for when you need to call a proprietary method such as PostgreSQL’s lo_* methods.
Active Record cannot track if the database is getting modified using this client. If that is the case, generally you’ll want to invalidate the query cache using ActiveRecord::Base.clear_query_cache.
Source
# File activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 813
def raw_connection
with_raw_connection do |conn|
disable_lazy_transactions!
@raw_connection_dirty = true
conn
end
end
Defined in activerecord/lib/active_record/connection_adapters/abstract_adapter.rb line 813
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::AbstractAdapter