Rails bug?带有datetime_select的模型表单无法设置默认值

时间:2015-02-02 06:48:41

标签: ruby-on-rails forms

有没有人碰到过这个?在与模型相关联时,我无法使用表单设置我的时间默认值

e.g。

<%= f.datetime_select :date_start, { default: @event.date_start.in_time_zone(current_user.time_zone), ampm: true, use_short_month: true, start_year: Time.now.year, end_year: Time.now.year+1, minute_step: 5}, class: 'form-control form-control-date' %>

我需要默认的原因是因为它默认为utc。我需要编辑表单来计算时区,否则用户会看到他们输入的错误时间。

实际上,它完全忽略默认值并将其保留为UTC。这是编辑表单中的一个问题。

如果我将其更改为标签,则默认有效。但是,我需要将所有表单更改为标记,以便表单正确提交。

除了可能这样做之外,还有人有解决方法吗?

0 个答案:

没有答案