rails--rails/guides
Sarah Vessels f7d7a22d01
Add has_one through disable_joins
This is similar to the `disable_joins` option on `has_many :through`
associations applied to `has_one :through` associations. When
`disable_joins` is set Rails will create 2 or more queries to get
associations instead of generating a join.

```ruby
class Person
  belongs_to :dog
  has_one :veterinarian, through: :dog, disable_joins: true
end
```

Then instead of generating join SQL, two queries are used for `@person.veterinarian`:

```
SELECT "dogs"."id" FROM "dogs" WHERE "dogs"."person_id" = ?  [["person_id", 1]]
SELECT "veterinarians".* FROM "veterinarians" WHERE "veterinarians"."dog_id" = ?  [["dog_id", 1]]
```

Co-authored-by: Eileen M. Uchitelle <eileencodes@gmail.com>
2021-05-07 09:00:42 -04:00
..
assets [ci skip] Adds Dark Mode Iconography 2021-04-19 09:20:20 -06:00
bug_report_templates Update all Migration version references 2021-05-02 21:17:04 +09:00
rails_guides use ruby 2.7's filter_map instead of select + map 2021-04-26 17:55:33 -04:00
source Add has_one through disable_joins 2021-05-07 09:00:42 -04:00
.document
CHANGELOG.md Start Rails 6.2 development 🎉 2020-12-03 01:35:29 +00:00
Rakefile Remove references to WARNINGS environment variable [ci skip] 2020-07-05 16:40:52 +01:00
rails_guides.rb Use safe nav operator when calling RailsGuides::Generator.new 2018-12-05 12:41:07 +09:00
w3c_validator.rb