Hello there.
I'm running Rails 1.1.6, Ruby 1.8.4 on Windows XP. I checked out the plugin from SVN today into vendor/plugins, so it should be the latest version.
However, I'm running SQLite3 - which is where I guess the problem arises (unless this problem exists for everyone - which I hope it doesn't!)
I have a model called "Category" which acts_as_nested_set. If I run script/console (in a new database) and set some things up like this:
main = Category.new(:name => 'Main')
main.save
sub = Category.new(:name => 'Sub Category')
sub.save
sub.move_to_child_of main
sub.save
main.save
(I'm not really sure which of those saves are necessary, but I'm playing it safe!)
I get some odd results:
main.id # returns 1 - ok
sub.id # returns 2 - ok
main.children # returns sub object - ok
sub.parent # returns main object - ok
main.children_count # returns 0 - ???
main.full_set # returns just main object - ???
main.all_children # returns [] - ???
The problem appears to be in the setting of rgt. I assume from the readme that the situation right now should be:
MAIN - id 1 - lft 1 - rgt 4 ... SUB - id 2 - lft 2 - rgt 3
But in actual fact:
main.lft # 1 - ok
sub.lft # 2 - ok
sub.rgt # 3 - ok
main.rgt # 2 - ???
Is this SQLite3 specific? Any plans to resolve this, or pointers to how I might be able to solve this?
Many thanks in advance for any advice you may be able to give.
Regards,
NeilS.