-
Notifications
You must be signed in to change notification settings - Fork 241
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
ActiveRecord::StatementInvalid (null value) on rebuild! #2
Comments
Ok it must be an issue, because I'm getting the same error when I'm trying to add child: User.find(1).add_child User.find(2) Or: User.find(1).children << User.find(2) I'm using version 1.0.0 of closure_tree and Rails3.1rc4 (can't update to stable for now) |
The rebuild shouldn't be trying to insert rows where there isn't an ancestor. I'll switch to postgres and write a test. |
FWIW, this is the trace using rails 3.1.1 and MySQL:
(so that works, at least). I'll try pg now. |
OK, I just pushed 2.0.0.beta1, and with it:
If you upgrade you should be good. Make sure you call the #rebuild! class method after you upgrade, though. |
Unfortunately due to this issue I had to change to some other gem in my last project, but I promise I'll try new version and check if it works fine :) |
I've got problem when I'm trying to rebuild hierarchies table. Running User.rebuild! causes this error:
https://gist.github.com/1244628 (tried this on sqlite3 and postgresql)
My model:
Migration file:
Is this a bug or am I doing something wrong?
The text was updated successfully, but these errors were encountered: