【发布时间】:2011-09-04 09:49:51
【问题描述】:
如何排除此范围内的某些项目:
scope :within_category, ->(category) { joins(:category).where(:categories => { :id => category }) }
像这样:
scope :within_category, ->(category, item_type) { joins(:category).where(:categories => { :id => category }, :id NOT IN item_type.id) }
【问题讨论】:
标签: ruby-on-rails activerecord scope