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!