# Display datas from database using List box

**URL:** <https://www.ruby-forum.com/t/display-datas-from-database-using-list-box/83872>\
**Category:** Rails\
**Created:** [January 30, 2007, 12:18pm UTC](https://www.ruby-forum.com/t/display-datas-from-database-using-list-box/83872 "2007-01-30T12:18:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ror](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee59a6/32.png) [@ror](https://www.ruby-forum.com/u/ror)\
**Post date:** [January 30, 2007, 12:18pm UTC](https://www.ruby-forum.com/t/display-datas-from-database-using-list-box/83872/1 "2007-01-30T12:18:49Z")

</div>

HI,

i need to diaplay data’s in a List box. actuall i don’t know coding  
for List box. if its combox box means i can use collection\_select. so  
can anyonel tell this- urgent

---

<div class="post-metadata">

**Author:** ![ror](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee59a6/32.png) [@ror](https://www.ruby-forum.com/u/ror)\
**Post date:** [January 30, 2007, 12:29pm UTC](https://www.ruby-forum.com/t/display-datas-from-database-using-list-box/83872/2 "2007-01-30T12:29:54Z")

</div>

> i need to diaplay data’s in a List box. actuall i don’t know coding  
> for List box. if its combox box means i can use collection\_select. so  
> can anyonel tell this- urgent  
> You can use collection\_select for this:

collection\_select(‘object’, ‘method’, @panels, :id, :name, {},  
{:multiple =\> ‘multiple’})

Also, it is sometimes considered quite rude to post messages with  
‘urgent’ in them (as you have done in your last 3 posts). The  
response from this group is normally very quick as everyone is happy  
to help, regardless of urgency on your part.

Steve

---

<div class="post-metadata">

**Author:** ![ror](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/ee59a6/32.png) [@ror](https://www.ruby-forum.com/u/ror)\
**Post date:** [January 30, 2007, 1:27pm UTC](https://www.ruby-forum.com/t/display-datas-from-database-using-list-box/83872/3 "2007-01-30T13:27:04Z")

</div>

hi,

i got the answer when i user the panel table. but when i have to use  
Demogaphic\_categories table. if i use this it shows the error in

Expected ./app/models/demographic\_category.rb to define  
Demographic\_category

```
Like this.

```

dataBase name is - Demographic\_categories

fields - id, name, allow\_multiple

my coding:

index.rhtml

\<%= collection\_select(‘object’, ‘method’, @demographic\_categories, :id,  
:name, {},  
{:multiple =\> ‘multiple’}) %\>

in controller:

@demographic\_categories=Demographic\_category.find(:all);

```
can u tell this what's the error in this? please

```

Stephen B. wrote:

> > i need to diaplay data’s in a List box. actuall i don’t know coding  
> > for List box. if its combox box means i can use collection\_select. so  
> > can anyonel tell this- urgent  
> > You can use collection\_select for this:
> 
> collection\_select(‘object’, ‘method’, @panels, :id, :name, {},  
> {:multiple =\> ‘multiple’})
> 
> Also, it is sometimes considered quite rude to post messages with  
> ‘urgent’ in them (as you have done in your last 3 posts). The  
> response from this group is normally very quick as everyone is happy  
> to help, regardless of urgency on your part.
> 
> Steve
