Forum: Ruby on Rails select_tag with multiple set to true returns a String in params instead of array

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.
dino d. (Guest)
on 2009-05-05 17:08
(Received via mailing list)
Hi - I'm trying to get a multi-select box working.  The form shows up
fine, and I can select multiple items fine, but in the controller, the
parameter shows up as a single string, instead of an array of values.
Any ideas?

The form:

<%=select_tag "items", @items, :multiple => true :onchange =>

The form goes to function update_items in the controller, which fires
just fine.  But params[:items] is a single string value.

Thanks in advance for any help.

Frederick Cheung (Guest)
on 2009-05-05 17:46
(Received via mailing list)
On May 5, 4:07 pm, "dino d." <> wrote:
use "items[]" for the first parameter ? (I though rails might do this
automatically, obviously not)

dinoD (Guest)
on 2009-05-05 18:02
(Received via mailing list)
awesome, fixed.  thanks fred.

On May 5, 11:42 am, Frederick Cheung <>
This topic is locked and can not be replied to.