Skip to content
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

Sometimes wouldn't restoring with recursive and recovery_window has_one model #498

Closed
kinkinkon1009 opened this issue Jul 25, 2020 · 1 comment

Comments

@kinkinkon1009
Copy link

Hi.

In my application, I encountered unintentionally behavior.

With this simple example

class ParentModel < ApplicationRecord
  acts_as_paranoid
  has_one :child_model, dependent: :destroy
end

class ChildModel < ApplicationRecord
  acts_as_paranoid
  belongs_to :parent_model
end

There are related one ParentModel and two ChildModels records.
They are all deleted.

One ChildModel is deleted 20minutes ago.
One ParentModel and the other ChildModel is deleted 5minutes ago

And then call #restore with recursive and recovery_window.

parent_model.restore(:recursive => true, :recovery_window => 10.minutes)

ParentModel is restored intentionally.
But no ChildModel is restored.

@kinkinkon1009 kinkinkon1009 changed the title Sometimes wouldn't restoring recursively with recovery_window has_one model Sometimes wouldn't restoring with recursive and recovery_window has_one model Jul 25, 2020
kinkinkon1009 added a commit to kinkinkon1009/paranoia that referenced this issue Jul 25, 2020
…_one.

restoring properly even when multiple deleted has_one recoreds.

fixes rubysherpas#498
kinkinkon1009 added a commit to kinkinkon1009/paranoia that referenced this issue Jul 25, 2020
…_one.

restoring properly even when multiple deleted has_one records.

fixes rubysherpas#498
@kinkinkon1009
Copy link
Author

I haven't worked this Issue and PR for a long time.
So once I closed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant