Get list_box from sql RUBY / shoes GUI

I have one problem How to insert a list from a database in a list

Example i am trying

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

but I know that he repeated many list fields

tried to

 @users = list_box :items => $row_user 

but returns values ​​using ["user"]

+4
source share
2 answers

I tried this with green_shoes, but it should work with any color, just add smoothing to your $ row_user array

 @users = list_box :items => $row_user.flatten 

here is a working sample

 require 'green_shoes' app = Shoes.app :width => 500, :height => 600 do users = [["peter"], ["joe"]] stack do users = list_box :items => users.flatten end end 
+1
source

got

 edit_line $row_user.join 

for one value

0
source

Source: https://habr.com/ru/post/1439939/


All Articles