Skip to content

Commit 1714716

Browse files
authored
Merge pull request rails#43437 from ashiksp/updated-disable-joins-examples
Updated disable_joins examples for has_one through association.
2 parents b5f2b55 + 1700fd4 commit 1714716

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

activerecord/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@
647647

648648
```ruby
649649
class Person
650-
belongs_to :dog
650+
has_one :dog
651651
has_one :veterinarian, through: :dog, disable_joins: true
652652
end
653653
```

guides/source/active_record_multiple_databases.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,18 @@ class Dog < AnimalsRecord
506506
has_many :treats, through: :humans, disable_joins: true
507507
has_many :humans
508508
509-
belongs_to :home
509+
has_one :home
510510
has_one :yard, through: :home, disable_joins: true
511511
end
512+
513+
class Home
514+
belongs_to :dog
515+
has_one :yard
516+
end
517+
518+
class Yard
519+
belongs_to :home
520+
end
512521
```
513522

514523
Previously calling `@dog.treats` without `disable_joins` or `@dog.yard` without `disable_joins`

0 commit comments

Comments
 (0)