简单表单(日期字段)返回错误的参数类型Hash(应为Array)



我有一个日期字段,并尝试使用simple_form。

<%= f.input :opening_date %>
<%= f.input :opening_date, as: :date %>

始终返回一个错误:错误的参数类型Hash(应为Array(。rails助手date_select工作正常。

<%= f.date_select :opening_date, order: [:day, :month] %>

我的字段类返回
opening_date.class=日期

Rails:6.0.2.1.
ruby:2.6.5。

您将:作为带有错误的参数传递。使用字符串类型。为了使用html5日期字段,您可以执行以下操作:

<%= f.input :opening_date, as: :string, input_html: {type: :date} %>

最新更新