Restrict scope in acts_as_list

194 Views Asked by At
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

I would like to restrict the items acts_as_list is managing, not only by the parent association (TodoList) but aswell by items that have the done_at attribute present:

scope :active, -> { where("done_at is NULL)}

How can I add query rules to acts_as_list's scope?

0

There are 0 best solutions below