class TodoList < ActiveRecord::Base
has_many :todo_items, -> { order("position ASC") }
end
class TodoItem < ActiveRecord::Base
belongs_to :todo_list
acts_as_list scope: :todo_list
end
我想限制acts_as_list管理的项目,不仅是由父关联(TodoList)管理,还包括具有done_at
属性的项目:
scope :active, -> { where("done_at is NULL)}
如何向acts_as_list的范围添加查询规则?