-
Notifications
You must be signed in to change notification settings - Fork 880
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Original gets overwriten if column is a serialized Array #25
Comments
Please could you post a short gist / code snippet demonstrating the problem? I.e. what you expect to happen and what actually happens. That'll help me figure out the problem for you. Thanks, |
thanks for the reply, I've been looking into the code but was still unable to find a reason. What I am doing is using the paper_trail gem to create a table that has a serialized array in it. Controller --later To my understanding this should make 2 versions entries, one as head, which contains nothing, and another that stores the version I made with instance a, version = Versions.find( origin_id ) Am I just doing this wrong? I am sorry to be irresponsible but have become very busy at the moment, and may not be able to commit my efforts adequately, but will try to give all the information needed. I'll try to strip the sensitive info out and make a better example. |
and I've mistakenly pushed to comment and close button.... |
It sounds like you're doing it right. When I'll look into this for you, but I'm very busy like you and I probably won't get a chance for several days (and then I'm away on holiday for a week)... |
No problem, I'm making you wait, so should you |
I think I found out a way to recreate my problem, the problem was is that the serialized Array I had inside the paper_trailed model was nested and included hashes inside,and the changes inside the hashes do not seem to be recognized as changes. here is the gist for what I typed in The reason why the original was getting overwritten was because I had another attribute, which was a normal string inside AAA, which I was updating as well, which would cause a new version to be made, however paper_trail would not notice that aa.foo was changed, and would save over it. thus altering the original. Now, having such an ugly thing inside a database is truly just poor design, but thats another story. Hope this helps you. |
PaperTrail uses ActiveModel::Dirty's I think this is why your modification ( |
Closing because it's gone quiet. Please re-open if you like. |
Your plugin is working great except for one issue, I have a serialized Array stored inside a model that is being versioned, and any changes done to the Array seems to be going through, when I call model.save or model.update_attribute :Array_column, the original data entry seems to be updated, thus loosing the original data, which is a critical issue in my case. Please help
The text was updated successfully, but these errors were encountered: