instance method
verify!
Ruby on Rails 7.1.6
Since v2.2.3Signature
verify!()
Checks whether the connection to the database is still active (i.e. not stale). This is done under the hood by calling #active?. If the connection is no longer active, then this method will reconnect to the database.
Source
# File activerecord/lib/active_record/connection_adapters/abstract_adapter.rb, line 775
def verify!
unless active?
@lock.synchronize do
if @unconfigured_connection
@raw_connection = @unconfigured_connection
@unconfigured_connection = nil
attempt_configure_connection
@verified = true
return
end
reconnect!(restore_transactions: true)
end
end
@verified = true
end
Defined in activerecord/lib/active_record/connection_adapters/abstract_adapter.rb line 775
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::AbstractAdapter