using multiple select form

I think this is a simple problem but I haven't had any luck so far.

Here are the models involved:

Product has_and_belongs_to_many SubCategories SubCategory belongs_to Category / has_and_belongs_to_many Products Category has_many SubCategories

So when creating a new Product I have a multiple select form of SubCategories grouped by the Categories they belong to. I use option_groups_from_collection_for_select to create the optgroups / options.

When this form is submitted, the only parameter from this form is the first one selected:

"sub_category"=>{"id"=>"3"} or whatever is all that shows up.

Here is the view: [select multiple="multiple" name="sub_category[id]" id="sub_category[id]"]             [%= option_groups_from_collection_for_select(@categories, :sub_categories, :name, :id, :name) %]         [/select]

(new to the mailing list, dunno if it eats html )

Thanks,

-Aaron