开发者

Default value not set in select

can anyone see why "9:00" isn't selected in this select?

=f.fields_for :hours do |hours_form|
  = hours_form.text_field :start_time # outputs "9:00"

  =hours_form.select :start_time, possible_hours_stop() # outputs a select including one where va开发者_StackOverflowlue="9:00"

Shouldn't "9:00" be selected since that's the value of :start_time?


I would try this:

=hours_form.select :start_time, options_for_select(possible_hours_stop(), hours_form.object.start_time)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜