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

Get ancestors in a callback #58

Closed
thcottin opened this issue May 29, 2013 · 1 comment
Closed

Get ancestors in a callback #58

thcottin opened this issue May 29, 2013 · 1 comment

Comments

@thcottin
Copy link

Hello,

I'm using closure_tree 4.0.1 with rails 3.0 and ruby 1.9.3

In the model I use to act_as_tree, I need to trigger an after_create callback when a leaf is created. This callback needs the ancestors of the current object to do some operation.

Unfortunately, I cant access the ancestors in the after_create because it seems that the hierarchie of the newly created object is written in the table after the callbacks.

Would you have any idea how to fix this issue ?

@mceachen
Copy link
Collaborator

mceachen commented Jun 9, 2013

You could use an after_commit—the hierarchies will be in place by then.

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

No branches or pull requests

2 participants