Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use grouped_collection_select to show multiple selection?

I'm using the following code to display a tree view selection box of categories:

grouped_collection_select(:categories, :category_id, Category.top_level, :children, :name, :id, :name, :include_blank => true)

How can I change it to allow multiple selection?

Also, is it possible to have it display checkboxes instead of a select box?

like image 633
Jacob Avatar asked Dec 21 '11 12:12

Jacob


1 Answers

try

grouped_collection_select(:categories, :category_id, Category.top_level, :children, :name, :id, :name, {:include_blank => true}, { :multiple => true }
like image 130
Manivannan Jeganathan Avatar answered Sep 28 '22 18:09

Manivannan Jeganathan