Best way to compute data from "old" records

Hi.

I’m looking for different point of views, or maybe a “state of the art”
view, for a technically simple question.

I have many models that a user has the power to destroy, and I also want
to
compute data from these models, even after they are destroyed.

2 choices are possible (maybe other can be found?):

  • not deleting data (and move them in an archive table, or keep them in
    their original place with a marker saying they are deleted)
  • pre-computing data from the deleted stuff (in order to be re-analyzed
    later). The point here is to fill another table, for example ‘stats’,
    with
    few rows, and deleting (destroying) all the records that the user wants
    to
    destroy.

What do you think is the best?

On Wed, May 18, 2011 at 9:09 AM, Michel P. [email protected]
wrote:

their original place with a marker saying they are deleted)

  • pre-computing data from the deleted stuff (in order to be re-analyzed
    later). The point here is to fill another table, for example ‘stats’, with
    few rows, and deleting (destroying) all the records that the user wants to
    destroy.

What do you think is the best?

If it were me I would consider what the cost of doing your first option
(the
delete flag) would be in terms of table size and its result on the app.
If
it is not an issue, go this way, it will be easier I think. Also, if you
run
your analysis reports on some regular basis, you could purge records
flagged
as deleted after you run the report. Your second option of pre-computing
I
like if you know exactly what you want… that also would not be so bad,
you
just add a callback ‘on delete’ which does this for you.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs