James
2007-May-03 01:50 UTC
Marking/Flagging a record as deleted/expired instead of actually removing the row from the database
Hi, I''ve a system which does not delete records from the database but marks them as ''expired'' and the excludes such in any view of the current data. Is there an easy way to override the behaviour of AR.destroy to have it behave in this fashion or am I best off just introducing an "expire" method instead? Thanks, James. --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jodi Showers
2007-May-03 01:59 UTC
Re: Marking/Flagging a record as deleted/expired instead of actually removing the row from the database
On 2-May-07, at 9:50 PM, James wrote:> > Hi, > > I''ve a system which does not delete records from the database but > marks them as ''expired'' and the excludes such in any view of the > current data. > > Is there an easy way to override the behaviour of AR.destroy to have > it behave in this fashion or am I best off just introducing an > "expire" method instead? > > Thanks, > James. >James, Check out Rick''s fine acts_as_paranoid - it does what you''ve done but overrides delete. http://agilewebdevelopment.com/plugins/acts_as_paranoid Cheers, Jodi General Partner The nNovation Group inc. www.nnovation.ca/blog --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Gregory Seidman
2007-May-03 02:01 UTC
Re: Marking/Flagging a record as deleted/expired instead of actually removing the row from the database
On Thu, May 03, 2007 at 01:50:44AM -0000, James wrote:> > Hi, > > I''ve a system which does not delete records from the database but > marks them as ''expired'' and the excludes such in any view of the > current data. > > Is there an easy way to override the behaviour of AR.destroy to have > it behave in this fashion or am I best off just introducing an > "expire" method instead?acts_as_paranoid http://ar-paranoid.rubyforge.org/> Thanks, > James.--Greg --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
James Walker
2007-May-03 05:00 UTC
Re: Marking/Flagging a record as deleted/expired instead of actually removing the row from the database
Thanks to both Jodi & Gregory for that Cheers, James On 03/05/07, Gregory Seidman <gsslist+ror-dNXPQ6k9rNiG6BJUYyje5axOck334EZe@public.gmane.org> wrote:> > > On Thu, May 03, 2007 at 01:50:44AM -0000, James wrote: > > > > Hi, > > > > I''ve a system which does not delete records from the database but > > marks them as ''expired'' and the excludes such in any view of the > > current data. > > > > Is there an easy way to override the behaviour of AR.destroy to have > > it behave in this fashion or am I best off just introducing an > > "expire" method instead? > > acts_as_paranoid > > http://ar-paranoid.rubyforge.org/ > > > Thanks, > > James. > --Greg > > > > >--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---