16 May 22:20
Re: ANNOUNCE: act_as_soft_deletable - new rails plugin for soft deleting / disabling ActiveRecord models
From: Danimal <fightonfightwell@...>
Subject: Re: ANNOUNCE: act_as_soft_deletable - new rails plugin for soft deleting / disabling ActiveRecord models
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2008-05-16 20:20:28 GMT
Subject: Re: ANNOUNCE: act_as_soft_deletable - new rails plugin for soft deleting / disabling ActiveRecord models
Newsgroups: gmane.comp.lang.ruby.rails
Date: 2008-05-16 20:20:28 GMT
One other thought:
What if you extended this, either as a second plugin, or just
additional features, to add "acts_as_archivable"? Which is effectively
the same thing, but instead of thinking in terms of "delete" and
"undelete", it's "archived" or not.
And, I could see some cool hooks you could do. Like adding some cool
find mods. Off the top of my head:
Assuming I have a Post model with lots of posts, I might want to do
something like:
Post.find_and_archive(:all, :conditions => ["created_at < ?",
1.month.ago])
This would return an array of post objects that are older than 1
month, but it would also "move" them from the posts table to the
archived_posts table.
The other cool thing is that you could then make wicked simple rake
tasks to do archival maintenance.
Maybe even some hooks so that you could do "global" finds... i.e.
finds that would aggregate the X and archived_X tables.
Post.find_with_archive_by_author("John Do") # => would find all posts
from the "posts" table AND the "archived_posts" table
Just some thoughts.
Keep it up!
-Danimal
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
RSS Feed