Quick Q: How to add a blank category to Category.find_all?
Hi,
The app I'm currently building is my first attempt at a full RoR website. I've got most of my multi-level category system working how I would like (acts_as_nested_set is great!) but there is one little thing I've got stuck on:
In my new category function I have the following code:
Code:
def new
@category = Category.new
@categories = Category.find_all
end
This works great for having a Category dropdown where I can select the new category's parent, however it doesn't let me create a new category as a root-level item.
How can I add a blank (or equivalient root-level) item to the beginning of @categories?
I know it's probably simple but I havn't seen any mention of this in tutorials or books so far so I'm sure others like me will find the answer useful.
Thanks,
Kev