instance method
connected_to_all_shards
Ruby on Rails 8.1.2
Since v8.0.4Available 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
-
rolekey = nil -
prevent_writeskey = false -
blkblock
Source
# File activerecord/lib/active_record/connection_handling.rb, line 189
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 189
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in ActiveRecord::ConnectionHandling