user2732663
user2732663

Reputation: 833

ROR maintain history of object updates

I have a model which I want to store a history of changes to, my plan is to rather than update an object create a new one and on a show only fetch the latest version.

This plan presents a number of difficulties firstly the id will be different after a update I indend to get around this by keeping a second ID column which will be the same for all updates of that instance.

to that end I have created a SQLite sequence for this second coloumn.

my question is how can I get values from this sequence in the model/controller as I will only want to get from it on first time the object is created, secondly how can I use this second ID column as the URL for the object so it is fixed throughout updates.

Many Thanks,

Upvotes: 0

Views: 536

Answers (1)

doctororange
doctororange

Reputation: 11810

Check out the PaperTrail gem. It might do what you want and sidestep those issues completely.

https://github.com/airblade/paper_trail

Upvotes: 2

Related Questions