-
书
labelTimer
页 -
第
Sorted S = {0,1,3,4,5,6,8,9} A = [A0,A1,A2] --- A0,A2 -- (Binary,part of subset = 1 not part = 0 ) Index | A0,A2 | Sorted Sum 0 0 0 0 0 1 1 0 0 1 2 0 1 0 3 3 1 1 0 4 4 0 0 1 5 5 1 0 1 6 6 0 1 1 8 7 1 1 1 9 From her we can reverse and find that A0 = S[2^0],A1 = S[2^1],A2 = S[2^2]
页的书 -
页面具有布尔属性
has_many
这样,书号:1条记录可能具有:
- 第1页,其中
belongs_to
为真 - 第2页,
read
为真 - 第3页,其中
read
为假
然后,书号:2为:
- 第1页,其中
read
为真 - 第2页,
read
为真
通过这种方式,只能从查询中返回图书ID:2。
目前,我有:
read
同时返回图书read
和Book.includes(:pages).where(pages: {read: true})
。
如何解决?