Multi-select category listbox


#1

Hi, on to the final bit of my blogging engine and would really
appreciate a pointer in the right direction.

With each article they can be associated with multiple categories, so
inside the admin panel I need to somehow have a listbox that allows
users to select multiple categories and associated them to an article.

Now I can return an object of all the categories available and one that
contains all the categories the current article is associated, putting
that in a listbox and making it save the results is what stumps me.

any ideas?


#2

select_tag “article[category_ids][]“,
options_from_collection_for_select(@available_categories, “id”,
“name”), :multiple=>true

That should create a select box with multiple selected elements…