I use acts_as_list to generate slot numbers of books:
acts_as_list :scope => :book_id, :column => :slot
and have a default scope that prevents deleted (soft delete) books from getting in to result sets:
default_scope where(:is_active => true)
I want to prevent the default scope from getting applied to the acts_as_list declaration, because if someone deletes the last book, and creates a new one, they get the same slot number (because when it fetches the last slot number, the default scope gets applied and it doesn't get the deleted entry). I am aware of unscoped
, but how do I use it with acts_as_list?
I am using Rails 3.0.11.
wherever you use acts_as_list
just do this instead,
unscoped.acts_as_list