This project is archived and is in readonly mode.
Restore timestamps in model rollback
Reported by Xavier Noria | May 2nd, 2008 @ 03:12 AM
The current implementation of rollback_active_record_state! does some housekeeping like restoring @new_record. If you rollback a model after it was once saved like this
dev.rollback_active_record_state! do
Developer.transaction do
dev.save
# other stuff that may raise an exception
end
end
you may end up with a new_record? that has an initialized created_at for example.
This patch fixes that for timestamps.
Comments and changes to this ticket
-
Pratik May 12th, 2008 @ 02:16 AM
I wonder if it'd possible to use existing stored old values from Dirty module ?
Thanks.
-
Pratik May 13th, 2008 @ 05:45 PM
- State changed from new to incomplete
-
Rohit Arondekar October 6th, 2010 @ 06:47 AM
- State changed from incomplete to stale
- Tag set to activerecord, bug, patch
- Importance changed from to
Marking ticket as stale. If this is still an issue please leave a comment with suggested changes, creating a patch with tests, rebasing an existing patch or just confirming the issue on a latest release or master/branches.
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
People watching this ticket
Tags
Referenced by
- 256 Model objects are falsely marked as not-new after transaction rollback Also timestamps are not rolled back, so the new record m...