I have a Question class that has many related models. On one page of my application, I list a summary of all current issues with various information from related entries. Ultimately, this is a hash of the values, which I then simply print in the csv style string (I will call it a “hash string” from here)
Now I have a requirement only to show changes in questions (or related data) for a certain period. I am currently considering the best way to do this. Here are some ideas that I have had so far, I would welcome any feedback, thoughts, suggestions, etc.
1) Approach 1 - act_as_audited This was my first thought, since I used it before in other applications. However, the problem with aaa is that it only tracks changes in the record data (i.e., it doesn't matter if the association changes). That way, I could also check all related records, but then, trying to combine what has changed, linking different audit records, sounds like a nightmare.
2) Save the old and new hash in serialized fields: ie - when someone goes to the question / edit page, I calculate the current hash of the line and save it in the serialized field "old_data" in the question table. Then, after saving the question, I calculated a new hash of the current line and saved it in the serialized field "new_data" in the question table. In addition, I compare the two serialized hashes and store the differences in another serialized hash field of the “change” hash. Now, to make my report, I'm just looking for questions updated over the last x days, and the output of their change data.
3) - , , (.. , ). - -. , .
2.
/? - .