Forum: Ruby on Rails How to populate form dropdown with 2nd item of model

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.
ChrisYo (Guest)
on 2009-03-06 12:33
(Received via mailing list)
I'm trying to create a dropdown list that's populated from a model but
which has the 2nd item in the model as the default selection.  This is
possible.

Here's the model snippet.
  PROPERTY_TYPES = [['Choose',           ''],
                   ['Residential',       'Residential'],
                   ['Commercial',        'Commercial']]

Here's the form snippet
<%= f.select :property_type, Lead::PROPERTY_TYPES, :style => 'width:
100px;' %>

Is there a way to have the form default to "Residential" but still
allow the user to select either?

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