Hello there! This is my first post! ;)
I''m starting on ruby on rails, so I have many doubts about it!
I''m trying to create a system that uses categories/subcategories.
I created a scaffold for a table that has the following fields:
- id int(11)
- name varchar(50)
- keyname varchar(50)
- visible enum(''0'',''1'') default
''0''
- pid int(11)
The rows are added as:
1, Articles, articles, 1, 0
2, Ruby on Rails, rubyonrails, 1, 1
3, PHP, php, 1, 1
4, FAQ, faq, 1, 0
5, Question 1, q1, 1, 4
6, Question 2, q2, 1, 4
And so on....
The PID field denotes the parent category. So, I have a structure like:
Articles
-- Ruby on Rails
-- PHP
FAQ
-- Question 1
-- Question 2
My question is: I created a scaffold for CRUD the categories. How to add
a SELECT tag populated with all categories that doesn''t has the parent
id (pid)?
I want something like:
NEW CATEGORY
----------------
Name: _________
Keyname: _________
[x] Turn this category visible
Parent category: [------------------] <= combobox
[No parent category]
[Articles]
[FAQ]
Thanks!
--
Posted via http://www.ruby-forum.com/.