Hi, has anyone successfully used the acts_as_threaded plugin with
I’m using rails 1.0 and ruby 1.8.4 on linux.
Following the screencast on
I got to where we’re ready to create our first post, having made the
changes to controllers/posts_controller.rb, views/posts/_form.rhtml,
views/posts/show.rhtml, and models/post.rb as shown in the screencast.
When I submit the post I get an SQL error:
PGError: ERROR: null value in column “root_id” violates not-null
INSERT INTO posts (“name”, “updated_at”, “body”, “depth”, “lft”,
“subject”, “root_id”, “parent_id”, “rgt”, “created_at”)
VALUES(‘Richard Nixon’, ‘2006-03-14 19:45:58’,
‘Erase tape number 2347!’, 0, 0, ‘Memo’, NULL, NULL, 0,
We can see NULL values being provided for root_id and parent_id,
and I believe this to be incorrect. (I tried removing the NOT NULL
constraints, but got NoMethodError for nil exceptions further along.)
Note: The depth, lft, and rgt fields would have been NULL also, but I
set them to zero in the form manually before submitting the form.
This seems to be a key difference from the screencast. The
screencast shows the form already displaying default values of
zero for Depth, Lft, and Rgt:
Whereas in my app, these fields are blank:
Can anyone suggest any hints or ideas as to why the form in
the screencast would have default values pre-populated for some fields,
but my application presents the form with these fields uninitialized?
These are the files I’ve modified from the scaffold, with only the
very slight changes shown in the screencast:
Thanks for any help, hints, suggestions, possibilities, etc. !