Forum: Ruby on Rails Select helper question

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.
Petr (Guest)
on 2007-02-07 09:46
Ive got this:

@oss = Product.find(:all, :conditions => "part_type = 'Operating
System'").map {|u| [u.title, u.id]}

select(:system, :os, @oss)

I would like to add an empty space/or custom text in front of the list
of operating systems. such as:

<option>Select from the list</option>
<option id="1">Windows XP Professional</option>
........

How do i do this?

Thanks,
Petr
George O. (Guest)
on 2007-02-11 10:07
(Received via mailing list)
On 2/7/07, Petr <removed_email_address@domain.invalid> wrote:
>
> <option>Select from the list</option>
> <option id="1">Windows XP Professional</option>
> ........
>
> How do i do this?
>
> Thanks,
> Petr

Hi Petr,

How about:

  select(:system, :os, @oss, :prompt => 'Select from the list')

?

George.
This topic is locked and can not be replied to.