Forum: Ruby on Rails display datas from database using List box

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
ROR (Guest)
on 2007-01-30 13:18
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
Stephen B. (Guest)
on 2007-01-30 13:29
(Received via mailing list)
>   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
ROR (Guest)
on 2007-01-30 14:27
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
This topic is locked and can not be replied to.