Populating Select Dropdown for Editing?


#1

I’m having trouble populating a select tag in a form?

I have moved the form to a partial so it can be used in both the
create and edit views. My standard text fields are populated with
data from the DB just fine in the edit view, but I can’t seem to get
the select drop downs to work?

How do I force the default value of a select to the value stored in
the DB? Below is an example of what I have:

Open:<%= f.select
(:hours_sunday_open, @site.open_close_times) %>

I’ve tried the :selected => f.hours_sunday_open

It didn’t seem to work.

Thanks