Betternestedset in rails 3.0

Hi Guys,

when i upgraded my rails 2.3.4 to 3.0 my betternestedset is not working.
It was working fine in the older version. This is my controller

def new
cat = Category.new
cat.text=‘test’
cat.save
cat.move_to_child_of(Category.find_by_id(1)) #26
redirect_to :action => ‘index’
end

It gives me this error : “You cannot move a node if left or right is
nil”
app/controllers/categories_controller.rb:26:in `new’

Database looks like this :

“id” “parent_id” “lft” “rgt” “text”

“1” “NULL” “1” “2” “1000”
“2” “NULL” “NULL” “NULL” “abcd”

Thanks in advance

Vipin