RUBY/shoes GUI list_box from sql

Hello, i have one problem
How do I insert a list from the database in a listbox

Example i trying

$row_user = $db.execute( “SELECT user FROM usuarios” )
$row_user.each do |row|
@users = list_box :items => [row[0]]

but I know he has repeated many list box


@users = list_box :items => $row_user

but returns values ​​with ["_"]

Hi Danilo,

Although I don’t know the structure/format of your database.
Try out the following snippet. do
row_user = [[‘Danilo’, ‘Apple’, 2012], [‘ashbb’, ‘Orange’, 1999]]
list_box items:{|row|’ ')}

The Shoes-list_box-items should have an array not nested.

Hope this helps,

Thanks man, its worked

but i discovery other form do
users = [[“peter”], [“joe”]]
stack do
users = list_box :items => users.flatten

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs