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

:order option and previous_changes #151

Closed
randycoulman opened this issue Apr 30, 2015 · 1 comment
Closed

:order option and previous_changes #151

randycoulman opened this issue Apr 30, 2015 · 1 comment
Labels

Comments

@randycoulman
Copy link

I've been trying out closure_tree in a Rails 3.2.12 app, replacing a home-grown parent/child relationship.

The model in question has an after_commit hook that relies on the value of previous_changes. When I switch over to closure_tree and use the :order option, previous_changes is empty when my after_commit hook is called.

I haven't had a chance to put together a small, reproducible test case, but the root cause is the reload call in NumericDeterministicOrdering::_ct_reorder_siblings. reload causes both changes and previous_changes to be flushed and this happens before my after_commit callback has a chance to run.

I don't have a good sense of what it would take to fix this, sorry.

@mceachen
Copy link
Collaborator

You could look in hierarchy_maintenance.rb for an example of change hooks that you could add. I've never used previous_changes, but you could save that in a new before_save that you add.

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

No branches or pull requests

2 participants