Forum: Ruby on Rails multi-select category listbox

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.
John G. (Guest)
on 2008-10-19 22:19
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?
Freddy A. (Guest)
on 2008-10-20 00:33
(Received via mailing list)
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...
This topic is locked and can not be replied to.