Skip to content

Commit

Permalink
[ci skip] Fix shard docs followup
Browse files Browse the repository at this point in the history
Oops, the ShardRecord needs to be an abstract class and
ApplicationRecord needs to be a primary_abstract_class
  • Loading branch information
eileencodes committed Oct 16, 2023
1 parent 57d82b4 commit 0b1a6d7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion guides/source/active_record_multiple_databases.md
Expand Up @@ -428,12 +428,14 @@ Models are then connected with the `connects_to` API via the `shards` key:

```ruby
class ApplicationRecord < ActiveRecord::Base
self.abstract_class = true
primary_abstract_class

connects_to database: { writing: :primary, reading: :primary_replica }
end

class ShardRecord < ApplicationRecord
self.abstract_class = true

connects_to shards: {
shard_one: { writing: :primary_shard_one, reading: :primary_shard_one_replica }
shard_two: { writing: :primary_shard_two, reading: :primary_shard_two_replica }
Expand Down

0 comments on commit 0b1a6d7

Please sign in to comment.