在 Rails 3.2 中,关联选项是否counter_cache
链接到其他选项,例如counter_sql
或conditions
?
例如,如果我有这样的关联:
class User
has_many :items, :through => :orders
has_many :active_items, :through => :orders
:conditions => 'active = true', :source => :item
class Order
belongs_to :users, :counter_cache => :active_items_count
belongs_to :items
class Item
has_many :users, :through => :orders
计数器缓存会尊重该活动条件吗?(意味着不活动的项目不会被计算在内)那么使用finder_sql
/counter_sql