19 May 02:23
Re: ANNOUNCE: act_as_soft_deletable - new rails plugin for soft deleting / disabling ActiveRecord models
From: Shngn <hartforda@...>
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-19 00:23:18 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-19 00:23:18 GMT
On May 16, 1:13 pm, Danimal <fightonfightw...@...> wrote: > If you define your "Deleted" tables in a migration, why not build it > so that any future migrations would automatically adjust the deleted > tables? Yeah, that's a good idea. I did something similar with the update_columns class method, but your way is definitely slicker. One thing makes me a little uncomfortable though. If the migration drops a column, and it automatically gets dropped from the archive table then data is irretrievably lost. I can't decide if that's a bad thing, I'd love to get your thoughts on that. > 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. I originally intended to make an acts_as_paranoid replacement that worked with rails 2.0 and I got stuck in the 'deleted' paradigm. Now that you point it out I agree 'archive' is a better metaphor. I'll have to think about whether I want to go through the trouble to rename everything :) > Post.find_with_archive_by_author("John Do") # => would find all posts > from the "posts" table AND the "archived_posts" table This is a cool idea too! Its not obvious to me how I'd implement this. My first thought is method_missing so I could handle methods that start like 'find_with_archive...'. But I would need a way to decline to handle stuff like 'find_by_author' so that ActiveRecords method_missing can do its thing. I'm not sure how to do that but I'll play around with it. > Keep it up! > > -Danimal Thanks for the great ideas and I love to hear any more feedback and whether you were able to use it successfully! Andy --~--~---------~--~----~------------~-------~--~----~ 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