Forum: Ruby on Rails acts_as_tree and acts_as_list trouble

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Scott N. (Guest)
on 2005-12-10 22:06

I am having trouble with acts_as_tree and acts_as_list?

I have a table, pages = :id,:parent_id,:position,:title,:name.

In my model I have
acts_as_tree :order => "position"
acts_as_list :scope => :parent_id

When I add/remove rows, the position column updates perfect.

But when I try
@pg[@pg.position - 1].move_higher

I get:
NoMethodError in Admin#move_page_lower
You have a nil object when you didn't expect it!
The error occured while evaluating nil.move_higher"

and with:
@pg.pages[@pg.position - 1].move_higher

I get:
undefined method `pages' for #<Page:0x3761718>

How do I do a move_higher with acts_as_tree AND acts_as_list???
This topic is locked and can not be replied to.