Just finished the Agile Web Development with Rails book, and am working on my first little app...
I have a form that allows one to create new tasks. But a task can have (an optional) parent task, so I need a select list in the form which is populated with all the existing tasks.
My task table looks like this:
I think I've got all the relationships set up properly in my models, its just this form that's confusing me. You'd think you'd find lots of examples of this kind of thing, but even my recently finished book doesn't give any examples of populating a select from a db.Code:CREATE TABLE `tasks` ( `id` int(4) NOT NULL auto_increment, `parent_id` int(4) default NULL, `title` varchar(100) NOT NULL default '', `description` text NOT NULL, `estimated_hours` int(4) NOT NULL default '0', `start_on` date default NULL, `due_on` date NOT NULL default '0000-00-00', `user_id` int(4) NOT NULL default '0', `client_id` int(4) NOT NULL default '0', `type_id` int(4) NOT NULL default '0', `urgent` tinyint(4) default NULL, `on_hold` tinyint(4) default NULL, `percent_complete` int(4) NOT NULL default '0', PRIMARY KEY (`id`), KEY `parent_id` (`parent_id`), KEY `client_id` (`client_id`), KEY `type_id` (`type_id`), KEY `user_id` (`user_id`) ) TYPE=InnoDB AUTO_INCREMENT=1 ;
Can anyone help me with this, or even point me to a site with some good examples.
thx




Bookmarks