-
Notifications
You must be signed in to change notification settings - Fork 196
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
Failing to recover parent but has_one association gets recovered #130
Comments
I just realized that right now I am only observing this problem in my test environment. I will look into it and report back if I find anything. |
Unfortunately, no, it doesn't happen only in my test environment. I have seen the same behaviour in the development environment but not as consistently. When the user should correctly recover, sometimes his data doesn't recover with him for some reason. (all of this happens only sometimes with no change in the code between attempts) I will try to make a reproducible code snippet and upload it here soon. |
Taking a shot in the dark here, but I think the problem is the following:
which will update the dependent_assocations value in the database regardless of whether the User recover succeeded or not. |
I am trying to make a reproducible example in the form https://pastebin.com/TUUMxmu3 (it is probably wrong now, but it can't get past the bundler part), but it throws an error
If you can help me with how this script can work, I can look into making my issue reproducible. |
@frostblooded and @shadydealer the order of recovery has changed in version 0.7.3. Can you please check if the problem still occurs with that version? |
Unfortunately, I no longer have access to that code, but maybe @shadydealer can check it out. |
I have this interesting case where the user has a unique username, but after he gets soft-deleted the username is freed up. This means that trying to recover a soft-deleted user may fail, because his previous username may now be taken, which means the
#recover
should fail and returnfalse
and it does.The problem is that I call
deleted_user.recover
, it fails, and then if I check thedeleted_user.data
record, it has been recovered even though the parent object has not been recovered. I trieddeleted_user.data.reload
to see if maybe thedeleted_at: nil
that I am seeing for the data is only an unsaved value, but no, the data has really been recovered even after a reload or a direct database check.The text was updated successfully, but these errors were encountered: