Displaying 2 results from an estimated 2 matches for "fk_category".
Did you mean:
fcategory
2006 Jul 20
3
acts_as_tree
...t;Science Fiction")
------------------------------------------------------------------
And here is the database scheme:
------------------------------------------------------------
create table categories (
id int not null auto_increment,
name varchar(100) not null,
parent_id int,
constraint fk_category foreign key (parent_id) references categories(id),
primary key (id)
);
------------------------------------------------------------
in the model:
------------------------------------------------------------
class Category < ActiveRecord::Base
acts_as_tree :order => "name"
end
-----...
2005 Sep 23
6
problem with acts_as_tree
...ss Category < ActiveRecord::Base
acts_as_tree :order => "title"
end
create table categories (
id int not null
auto_increment,
title varchar(100) not null,
parent_id int,
constraint fk_category foreign key (parent_id)
references categories(id),
primary key (id)
);
When I try to use category.children I get an invalid member error.
When I changed this to:
class Category < ActiveRecord::Base
belongs_to :parent,
:class_name => "Category"...