instance method
connected?
Ruby on Rails 8.1.2
Since v2.2.3Signature
connected?(connection_name, role: ActiveRecord::Base.current_role, shard: ActiveRecord::Base.current_shard)
Returns true if a connection that’s accessible to this class has already been opened.
Parameters
-
connection_namereq -
rolekey = ActiveRecord::Base.current_role -
shardkey = ActiveRecord::Base.current_shard
Source
# File activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb, line 198
def connected?(connection_name, role: ActiveRecord::Base.current_role, shard: ActiveRecord::Base.current_shard)
pool = retrieve_connection_pool(connection_name, role: role, shard: shard)
pool && pool.connected?
end
Defined in activerecord/lib/active_record/connection_adapters/abstract/connection_handler.rb line 198
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionAdapters::ConnectionHandler