How to save data with paper_trail and show the new data at a later time?

250 Views Asked by At

Im using paper_trail with rails 4 and i would like to be able to do this:

what i want to do is run a crud action but i dont want it to be shown instant on the site, what i want is, it to be saved in the version table and later run a action let say at night wich will update the site with the changed data from the versioning.

So lets say i have a product: Name: Nike, Color: Blue And during the day i add a new product: Name:Nike, Color:Black I dont want this new product to be shown right away, but i want it to be stored in papertrail and at a later time take the stored data and show it. This goes for all the crud operations.

So if i would change the name of a product, the old one would still be shown until i run the stored data from papertrail and display it.

Hope iv managed to explaing my question, having some troubles wrapping my head around it.

Thank you for your time.

1

There are 1 best solutions below

1
On

I would recommend a more lightweight solution to your problem:

You can store a state with your data, lets say "new" is the first state when a user submits the data. In your application you use a default_scope to make sure that only data with the state of "reviewed" or "published" or whatever are visible to users.

You can then do whatever magical operation you want to perform at night without having a lot of trouble copying data from A to B.