So I have the following model
class Topic < ActiveRecord::Base
has_many :topics, :order => :position
acts_as_tree :order => :position
acts_as_list :scope => :topic_id
that I use for a site’s navigation. Everything (list, create, edit, even
the drag&drop sort) works fine, except the destroy function, which the
redirect_to :action => ‘list’
which gives me the following error
“Mysql::Error: Unknown column ‘topics.parent_id’ in ‘where clause’:
SELECT * FROM topics WHERE (topics.parent_id = 39) ORDER BY position”
Now, my table has the normal “id” field and a “topic_id” field that I am
using instead of “parent_id”, so I have have both - a list and a tree.
And, like I said, it works great and I was surprised at how simple the
whole thing was - until I tried to delete a topic and the whole thing
I also already tried
belongs_to :topic, :foreign_key => ‘topic_id’, :class_name => ‘Topic’
but that producced the same error.
So. Uhm. Help? :o)
Thanks for your time guys!