im trying to do default value for input
工作正常:
<%= f.input_field :quantity, default: '1' %>
但我需要的是f.input,而不是f.input_字段
<%= f.input :quantity %>
-
我正在用标准的html值进行try ——但在未成功验证后,数量被1覆盖——这是不需要的
<%= f.input :quantity, input_html: {value: '1'} %>
-
当我删除值且验证未成功时,填充完整数量-一切正常
<%= f.input :quantity %>
how to solve this ? is there any alternative like in f.input_field - :default ? or there is any other solution with value ?