Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

Create rake task that removes inactive / unused lists #28

Open
mshwery opened this issue Aug 28, 2012 · 0 comments
Open

Create rake task that removes inactive / unused lists #28

mshwery opened this issue Aug 28, 2012 · 0 comments

Comments

@mshwery
Copy link
Owner

mshwery commented Aug 28, 2012

Need a disclaimer to tell people that empty lists will be removed after a certain time of inactivity.

class Stack
   has_many :lists
end

class List
   belongs_to :stack
end

use:

empty_stacks = Stack.includes(:lists).where( :lists => { :stack_id => nil } )
empty_stacks.map { |stack| stack.destroy }
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant