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.

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

on-innovation.gif

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

Thanks to both Jodi & Gregory for that

Cheers,
James