On Wed, Jan 26, 2011 at 00:00, Dan Thomas <danthom1000 / gmail.com> wrote:
> Hello,
>
> I'm trying to make a drop down list from an array. =A0For now, just hard
> coding, later will use an actual array. This is in an erb file.
>
> The first problem is that I can't find documentation on "select". =A0Is i=
t
> a function, a class? =A0(I'm new to Ruby). =A0Can you point me to the
> documentation?
>
> The second problem is that according to some forums, the following
> should work, but it doesn't, and =A0I can't figure out the error message.
>
>
> <%=3D select("borrowers", "borrower_id", [ ["name1", "value1"],["name2",
> "value2"],["name3", "value3"]]) %>
>
> ERROR: =A0wrong argument type String (expected Array)
>
> I have tried everything. Thanks!

You can do how follow:

<% menus_list =3D [["name1", "value1"], ["name2", "value2"], ["name3",
"value3"]] %>
<%=3D select("borrowers", "borrower_id", options_for_select(menus_list)) %>

Hugs.
--=20
Marcello Henrique
Blog - http://faraohh.wordpress.com
Associa=E7=E3o Software Livre de Goi=E1s (www.aslgo.org.br)
Cercomp - UFG (www.cercomp.ufg.br)