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
Fix reverse of record_state after rollback #12922
Conversation
@rafaelfranca @robin850 @pftg please review this patch |
protected | ||
|
||
# Save the new record state and id of a record so it can be restored later if a transaction fails. | ||
def remember_transaction_record_state #:nodoc: | ||
@_start_transaction_state[:id] = id if has_attribute?(self.class.primary_key) | ||
if has_attribute?(self.class.primary_key) and !@_start_transaction_state.include?(:id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer &&/|| over and/or
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, you're right!
@akalyaev please, look again - I've corrected the patch |
@iantropov looks good to me 😄 |
Thanks @akalyaev ! |
@iantropov, the build seems to be broken, can you rebase and push an updated PR please? |
@vipulnsward I've rebased diff. Please review PR. |
@iantropov mysql seems to break due to this, can you check the cause? https://travis-ci.org/rails/rails/jobs/14770763 |
cc @arthurnn |
If you follow #7807 and eval @rafaelfranca #7807 is already closed based on #8577 (comment) and maybe this one should be too. |
I take it back. The state of the record should probably be fully restored. This PR needs some work since the code base has change considerably. @iantropov Would you mind if I give it a shot? |
Is this fixing this case too #20730 ? |
This issue has been automatically closed because of inactivity. If you can still reproduce this error on the Thank you for all your contributions. |
Fix reverse of record_state(new_record and id) after rollback.
Fix #7807