Default value for input with simple_form

前端 未结 6 1954
小鲜肉
小鲜肉 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:48

    You can try with something like this:

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

提交回复
热议问题