Forum: Ruby on Rails How to handle no category on select element?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Marko Å. (Guest)
on 2007-05-09 01:48
I have situation like this:

<p><label for="task_category_id">Assign:</label>
 <select name="category[category_id]" id="category_category_id">
 <option value="0">Choose</option>
 <option value="1">category 1</option>
 <option value="2">category 2</option>

So when I choose option 'Choose' with value 0 and I don't have a
category with that id i get error....

Making a new category in table with title = 'No category' doesn't feel

How can I handle that kind of problem?
This topic is locked and can not be replied to.