Ruby on rails 如何创建显示除一个类别以外的所有类别的范围
我想显示类别为1-9的照片,但不显示类别为15的照片 我试过:Ruby on rails 如何创建显示除一个类别以外的所有类别的范围,ruby-on-rails,Ruby On Rails,我想显示类别为1-9的照片,但不显示类别为15的照片 我试过: scope :no_landing, -> {where(category_id: [1,2,3,4,5,6,7,8,9])} 但必须有一种更有效的方法 有什么想法吗 谢谢大家 where.notcategory_id:15要添加到@RocketR的可能重复项,您需要将id传递给scope:scope:no_landing,->id{where.notcategory_id:id}以了解更多详细信息。
scope :no_landing, -> {where(category_id: [1,2,3,4,5,6,7,8,9])}
但必须有一种更有效的方法
有什么想法吗
谢谢大家 where.notcategory_id:15要添加到@RocketR的可能重复项,您需要将id传递给scope:scope:no_landing,->id{where.notcategory_id:id}以了解更多详细信息。