我与以下活动记录模型(示例)有一对一的关联:
User <-1-1-> employee <-1-1-> contact <-1-1->
permanentAddress contact <-1-1-> communicationAddress
当使用 ActiveRecord 触发查询时:
User Load (1.1ms) SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1 [["id", "49"]]
Employeedetail Load (1.8ms) SELECT "employeedetails".* FROM "employeedetails" WHERE "employeedetails"."User_id" = 49 LIMIT 1
Contactdetail Load (0.6ms) SELECT "contactdetails".* FROM "contactdetails" WHERE "contactdetails"."employeedetail_id" = 40 LIMIT 1
Address Load (1.1ms) SELECT "addresses".* FROM "addresses" WHERE "addresses"."contactdetail_id" = 52 LIMIT 1
CACHE (0.0ms) SELECT "addresses".* FROM "addresses" WHERE "addresses"."contactdetail_id" = 52 LIMIT 1
问题:如何将LIMIT
地址表增加到 2 [inner association]
。