In case anyone stumbles on this thread, I just refactored and pushed 
version 0.7.0:

https://github.com/sdepold/sequel-paranoid

On Monday, August 22, 2011 at 10:33:56 AM UTC-7, Jeremy Evans wrote:
>
> On Aug 22, 9:58 am, Christopher Krailo <[email protected]> wrote: 
> > I didn't see any paranoid delete plugins and Googling didn't turn up 
> > any, either. Do any of y'all know of one? 
>
> I don't think there is an existing one. 
>
> > Otherwise, I'll need to figure out how the plugin system works so I 
> > can contribute one. :) 
>
> Assuming that you want to keep old records in the same table and just 
> have a simple is_deleted flag, it should be fairly simple.  Override 
> Model#delete to do an update(:is_deleted=>true) instead of a delete, 
> and set a default filter on the model's dataset to 
> filter(:is_deleted=>false). 
>
> There are other ways of handling things, such as basing the model off 
> a view that filters deleted records, or having a separate table that 
> holds the deleted records.  Using a separate table is more complex, 
> but often better for performance, but then it makes it more difficult 
> to include both active and inactive records in the same query. 
>
> Personally, in similar cases I just define a subset (usually 
> "active"), and manually use it in all places I want only active 
> records appearing.  And I do the update manually instead of overriding 
> delete. 
>
> Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to