-
Notifications
You must be signed in to change notification settings - Fork 240
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
Rails 5.1 saved_changes is broken when updating parent_id on existing model #271
Comments
Naive fix #272 |
This is generating a lot of warnings with Rails 5.1 too:
However, I did not experience any problems so far. |
These warnings are with or without my patch. See #269 When you have not experienced any problem, have you tried exactly what I wrote in the description? I just need to validate my fix if there is something more which is needed to persist. And add test ofc :D |
I'd love to merge that PR, but the tests need to pass. I don't have time to help with that right now, I'm afraid. |
Hey, any progress on this? |
@Exelord feel free to fix the PR! |
If anybody can help with tests it would be awesome. |
@schovi this should have been fixed : https://github.com/ClosureTree/closure_tree/blob/master/lib/closure_tree/hierarchy_maintenance.rb#L38 |
@n-rodriguez seems fine 👍 |
Hey. I just stumbled into the same issue. In the Any plans to address this issue? |
Having simple model
When updating position attribute or other model attributes it behave as expected. But when I change
parent_id
it will printThe problem seems to be in closure tree after_save callback in if branch for not a new record.
which will obviously reload and clear model.
Quick solution is to put my callbacks before initializing closure tree in model
But it is not that pretty and you can run to other issues.
PS: think if there is more things which can break due to closure tree saving
The text was updated successfully, but these errors were encountered: