mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
f7d7a22d01
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> |
||
---|---|---|
.. | ||
active_record/connection_adapters | ||
activejob | ||
assets | ||
cases | ||
fixtures | ||
migrations | ||
models | ||
schema | ||
support | ||
config.example.yml | ||
config.rb |