Default value for input with simple_form

前端 未结 6 1968
小鲜肉
小鲜肉 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条回答
  •  猫巷女王i
    2021-02-03 17:35

    You can use the selected option of simple_form: <%= f.input :quantity, selected: f.object.quantity || '1' %>

提交回复
热议问题