lv-books

table1 : has_many :table2

table2: belongs_to :table1, has_many :table3

table3: belongs_to :table2

1、通过table1查询table3: table1.joins(:table2 => [:table3])

2、使用中间表关联:has_and_belongs_to_many

分类:

技术点:

相关文章: