Deactivate instances on delete

Hi,

I have created an application in which a customer model has many locations. Customers are then assigned to an order, and one of their locations is also assigned to the order.

My issue comes if a locations is removed from the customer, that was assigned to an order. I have added an active field to the locations table, and when I "delete" the location, it sets it to false.

My question is how to do the find statements correctly. Should I be overwriting the find method within the locations model to only return active locations? Then if I do that, and the order.location method is called, how do I get it to return the old location that is not active.

Am I going about this the right way or is there a more efficient way to handle it?

I have an old acts_as_paranoid plugin that does this. It overrides #destroy and tries to override #find so that the use of the deleted_at field is transparent. Problem is, it tends to break down in certain edge cases. I recommend you keep it a little more explicit and use the scope_out plugin.

http://svn.techno-weenie.net/projects/plugins/acts_as_paranoid/ http://code.google.com/p/scope-out-rails/

Thanks!

scope-out looks like it will do the trick.