Rails not editable text field

后端 未结 2 1206
一整个雨季
一整个雨季 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) %>
    
    0 讨论(0)
  • 2021-01-31 07:27

    Make it readonly !

    <%= location.text_field :country,:readonly => true%>
    
    0 讨论(0)
提交回复
热议问题