1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activerecord/test
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
..
active_record/connection_adapters
activejob Updated abbreviation for single table inheritance. 2021-04-16 11:53:05 +05:30
assets
cases Add has_one through disable_joins 2021-05-07 09:00:42 -04:00
fixtures Remove fixed "id" in encrypted book fixtures 2021-04-13 08:55:44 -04:00
migrations Show a warning when running no migration using SCOPE 2021-01-26 15:05:35 +01:00
models Add has_one through disable_joins 2021-05-07 09:00:42 -04:00
schema Add option to skip joins for associations. 2021-04-19 11:17:31 -04:00
support Allow async executor to be configurable 2021-02-19 12:34:57 -05:00
config.example.yml Make we always type cast TimeWithZone objects before passing to mysql2 2021-02-11 22:45:14 +00:00
config.rb