-
Notifications
You must be signed in to change notification settings - Fork 32
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
Paper Trail compatibility #13
Paper Trail compatibility #13
Conversation
I just realized I didn't add any specs for these changes. Let me know if these changes look good to you, and I'll go ahead and write some. |
Are any of these ActiveRecord 3.x only? The changes look fine to me, but tests would be greatly appreciated :) |
I'm pretty sure these will all work in ActiveRecord 2. I'll definitely cook up some tests! |
Alright, I finished writing tests and verified that everything works in every ActiveRecord version and both Ruby 1.8.7 & 1.9.3. I would link to a Travis run, but I haven't been able to trigger a Travis run today, either automatically or manually. |
Looks like Travis is working again. Everything is green! |
+1, this also handily removes a deprecation warning when running this plugin on 3.2-stable -rails/rails@50d395f |
Paper Trail compatibility
Sorry I'm terrible. We're not really using this gem anymore, so use at your own risk! |
Hi,
I've been trying to get serialized_attributes and Paper Trail to work happily together. It turns out that Paper Trail depends on quite a few ActiveRecord features that didn't happen to be implemented for serialized attributes.
Instead of creating a bunch of different pull requests, I decided to lump everything together and just summarize what got changed.
data
instead of usingsend(data_field)
.attribute_will_change!
.dup
so it copies over a dup of the serialized data. Previously, the dup'ed object would keep a reference to the same serialized data as the original object. This fix is necessary because Paper Trail creates a version by duping the object, and then setting all attributes back to their previous values. So, modifying the dup was also modifying the serialized attributes on the original object.[]=
AKAwrite_attribute
to modify serialized data.