Default value for input with simple_form

前端 未结 6 1942
小鲜肉
小鲜肉 2021-02-03 16:53

im trying to do default value for input

works ok:

<%= f.input_field :quantity, default: \'1\' %> 

but i need f.i

6条回答
  •  醉话见心
    2021-02-03 17:52

    You can do

    <%= f.input :quantity, value: f.object.quantity || '1' %>
    

    Nowadays, leaving off the input_html key.

提交回复
热议问题