instance method connected_to_all_shards

Ruby on Rails 8.0.4

Since v8.0.4

Available in: v8.0.4 v8.1.2

Signature

connected_to_all_shards(role: nil, prevent_writes: false, &blk)

Passes the block to connected_to for every shard the model is configured to connect to (if any), and returns the results in an array.

Optionally, role and/or prevent_writes can be passed which will be forwarded to each connected_to call.

Parameters

role key = nil
prevent_writes key = false
blk block
Source
# File activerecord/lib/active_record/connection_handling.rb, line 188
    def connected_to_all_shards(role: nil, prevent_writes: false, &blk)
      shard_keys.map do |shard|
        connected_to(shard: shard, role: role, prevent_writes: prevent_writes, &blk)
      end
    end

Defined in activerecord/lib/active_record/connection_handling.rb line 188 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveRecord::ConnectionHandling

Type at least 2 characters to search.

↑↓ navigate · open · esc close