method

current_shard

Importance_1
v7.1.3.4 - Show latest stable - 0 notes - Class: Core
current_shard() public

Returns the symbol representing the current connected shard.

ActiveRecord::Base.connected_to(role: :reading) do
  ActiveRecord::Base.current_shard #=> :default
end

ActiveRecord::Base.connected_to(role: :writing, shard: :one) do
  ActiveRecord::Base.current_shard #=> :one
end
Show source
Register or log in to add new notes.