How to add default value to a number_field in rails?

后端 未结 5 1477
长发绾君心
长发绾君心 2021-02-01 01:48

I\'ve created a form

<%= form_for [current_user,@product,@bid] do |f| %>
  

<%= f.number_field :bid_amount %>

<%= f.n

5条回答
  •  终归单人心
    2021-02-01 02:25

    Just add @product.id to your field.

    In this example <%= f.number_field :product_id, @product.id %>

提交回复
热议问题