我们如何编写以下语句以提高可读性?
Promotion.joins(:category).where(["lft>=? and rgt<=?", c.lft, c.rgt]).joins(:shops).where(:promotions_per_shops => { :shop_id => shops_id }).count('id', :distinct => true)
以下代码无法编译
Promotion.joins(:category)
.where(["lft>=? and rgt<=?", c.lft, c.rgt])
.joins(:shops)
.where(:promotions_per_shops => { :shop_id => shops_id })
.count('id', :distinct => true)
syntax error, unexpected '.', expecting kEND
.where(["lft>=? and rgt<=?", c.lft, c.rgt])