Hello,
I'm trying to make a drop down list from an array. For 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". Is it
a function, a class? (I'm new to Ruby). Can you point me to the
documentation?
The second problem is that according to some forums, the following
should work, but it doesn't, and I can't figure out the error message.
<%= select("borrowers", "borrower_id", [ ["name1", "value1"],["name2",
"value2"],["name3", "value3"]]) %>
ERROR: wrong argument type String (expected Array)
I have tried everything. Thanks!
···
--
Posted via http://www.ruby-forum.com/.
You can do how follow:
<% menus_list = [["name1", "value1"], ["name2", "value2"], ["name3",
"value3"]] %>
<%= select("borrowers", "borrower_id", options_for_select(menus_list)) %>
Hugs.
···
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. For 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". Is it
a function, a class? (I'm new to Ruby). Can you point me to the
documentation?
The second problem is that according to some forums, the following
should work, but it doesn't, and I can't figure out the error message.
<%= select("borrowers", "borrower_id", [ ["name1", "value1"],["name2",
"value2"],["name3", "value3"]]) %>
ERROR: wrong argument type String (expected Array)
I have tried everything. Thanks!
--
Marcello Henrique
Blog - http://faraohh.wordpress.com
Associação Software Livre de Goiás (www.aslgo.org.br)
Cercomp - UFG (www.cercomp.ufg.br)