2
,如何排除在此范围内的一些项目:排除ID在轨道范围
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) }