Rails not editable text field

后端 未结 2 1212
一整个雨季
一整个雨季 2021-01-31 06:56

I have a form_for written in the following manner:

<%= location.label :city %> <%= location.text_field :city, :disa
2条回答
  •  攒了一身酷
    2021-01-31 07:21

    The trick is to use "object" in conjunction with a label for anything you don't want to change. Here is how you should code it:

    <%= location.label(:country, f.object.country) %>
    

提交回复
热议问题