title: What is the best way to override Rails ActiveRecord destroy behavior?
body: <p>I have an application where I would like to override the behavior of destroy for many of my models. The use case is that users may have a legitimate need to delete a particular record, but actually deleting the row from the database would destroy referential integrity that affects other related models. For example, a user of the system may want to delete a customer with whom they no longer do business, but transactions with that customer need to be maintained.</p>
  
  <p>It seems I have at least two options: </p>
  
  <ol>
  <li>Duplicate data into the necessarily models effectively denormalizing my data model so that deleted records won't affect related data.</li>
  <li>Override the "destroy" behavior of ActiveRecord to do something like set a flag indicating the user "deleted" the record and use this flag to hide the record. </li>
  </ol>
  
  <p>Am I missing a better way?</p>
  
  <p>Option 1 seems like a horrible idea to me, though I'd love to hear arguments to the contrary. </p>
  
  <p>Option 2 seems somewhat Rails-ish but I'm wondering the best way to handle it. Should I create my own parent class that inherits from ActiveRecord::Base, override the destroy method there, then inherit from that class in the models where I want this behavior? Should I also override finder behavior so records marked as deleted aren't returned by default? </p>
  
  <p>If I did this, how would I handle dynamic finders? What about named scopes?</p>